/* Receipt viewer: a resurrection theme with restraint. Every color is a token on :root, and contrast is checked by
   test/site-style.test.js and the frozen look and style contracts. Fonts are system stacks; nothing is loaded.
   Motion lives only inside prefers-reduced-motion: no-preference, and a reduce block switches it all off. */

:root {
  --bg: #0e0b14;
  --surface: #1a1426;
  --stone: #221b2e;
  --line: #2f2642;
  --text: #ece8f5;
  --muted: #b9b0cf;
  --alive: #7dffb3;
  --grave: #ff9a9a;
  --accent: #ffa94d;
  --link: #8ecbff;
  --border: #6f6588;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* The root element paints the whole background once: the page color and the warm moon glow, fixed to the window. The
   body paints nothing, so no second background can end partway down a tall page and leave a band or a seam. */
html {
  min-height: 100%;
  background-color: var(--bg);
  background-image: radial-gradient(48rem 26rem at 88% -12%, rgba(255, 169, 77, 0.06), transparent 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body {
  margin: 0;
  color: var(--text);
  font: 1rem/1.6 var(--font-body);
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #3b2f55;
  color: var(--text);
}

/* ---- Fog: two faint layers low on the screen. Decorative, behind everything. Each layer fills the fixed window-sized
   box and every blob fades to nothing before it reaches an edge of that box, so no blob is ever cut off into a band,
   even when a phone's address bar changes the window height. ---- */

.fog {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.fog::before,
.fog::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -50%;
  right: -50%;
}

.fog::before {
  background:
    radial-gradient(closest-side at 22% 78%, rgba(185, 176, 207, 0.1), transparent),
    radial-gradient(closest-side at 64% 70%, rgba(185, 176, 207, 0.07), transparent);
}

.fog::after {
  background:
    radial-gradient(closest-side at 40% 84%, rgba(185, 176, 207, 0.08), transparent),
    radial-gradient(closest-side at 84% 76%, rgba(185, 176, 207, 0.06), transparent);
}

/* ---- Layout ---- */

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 50rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
  display: grid;
  gap: 0.625rem;
}

main > * {
  min-width: 0;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 1.2vw, 1.75rem);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text);
}

h3 {
  margin: 0 0 0.625rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

p {
  margin: 0 0 0.75rem;
}

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

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre {
  max-width: 100%;
  margin: 0 0 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

[hidden] {
  display: none !important;
}

.muted,
.limit {
  color: var(--muted);
}

/* ---- Header: the mark and the name, on one short line, so the result starts high on the page ---- */

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0;
}

.mark {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  overflow: visible;
}

.mark-ground {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
  stroke-linecap: round;
}

.mark-stone {
  fill: var(--stone);
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linejoin: round;
}

.mark-check {
  fill: none;
  stroke: var(--alive);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(125, 255, 179, 0.5));
}

.eyebrow {
  margin: 0 0 0.125rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  max-width: 36rem;
  font-size: 1.0625rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1.5rem;
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.legend-alive {
  color: var(--alive);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.legend-grave {
  color: var(--grave);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.875rem;
  margin-right: 0.125rem;
  vertical-align: -0.0625rem;
}

.swatch-alive {
  height: 0.75rem;
  border-radius: 50%;
  background: var(--alive);
  box-shadow: 0 0 8px rgba(125, 255, 179, 0.6);
}

.swatch-grave {
  background: var(--stone);
  border: 1px solid var(--grave);
  border-bottom-width: 2px;
  border-radius: 50% 50% 1px 1px / 45% 45% 1px 1px;
}

/* ---- The bar above the result: the sample switch and the way to open your own receipt, kept short ---- */

.bar {
  min-width: 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.bar > :last-child {
  margin-bottom: 0;
}

.bar .muted {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.bar .row {
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}

.bar .row button {
  padding: 0.4375rem 0.875rem;
  font-size: 0.875rem;
}

.bar .error {
  margin: 0 0 0.5rem;
}

.open-own summary {
  display: inline-block;
  padding: 0.125rem 0;
  color: var(--link);
  font-weight: 600;
  cursor: pointer;
}

.open-own[open] summary {
  margin-bottom: 0.625rem;
}

/* One short link under the sample switch: the How it works section sits far below the contract rows. Plain flow, the
   browser follows the anchor by itself. */
.jump {
  margin: 0.25rem 0 0;
  font-size: 0.9375rem;
}

.jump a {
  display: inline-block;
  padding: 0.125rem 0;
  font-weight: 600;
}

/* ---- The first-screen story: three beats from the real `necro demo` output, then the command to see it happen. Plain
   flow and plain text; the beats are a list that reads in the order it is drawn. ---- */

.strip {
  min-width: 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.beats {
  counter-reset: beat;
  list-style: none;
  margin: 0 0 0.625rem;
  padding: 0;
  display: grid;
  gap: 0.375rem;
}

.beat {
  counter-increment: beat;
  position: relative;
  min-width: 0;
  padding: 0.125rem 0 0.125rem 2rem;
  border-left: 3px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.35;
}

.beat::before {
  content: counter(beat);
  position: absolute;
  left: 0.625rem;
  top: 0.125rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}

.beat-refused {
  border-left-color: var(--grave);
}

.beat-accepted {
  border-left-color: var(--alive);
}

.try {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.try > * {
  min-width: 0;
}

.try-label {
  grid-column: 1 / -1;
  color: var(--muted);
}

.try #strip-copy-note {
  grid-column: 1 / -1;
}

.try code {
  grid-column: 1;
  grid-row: 2 / span 2;
  padding: 0.25rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow-x: auto;
}

.try button {
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: 0.3rem 0.875rem;
  font-size: 0.875rem;
}

.try #strip-copy-note:empty {
  display: none;
}

/* A control that does nothing without scripts is not drawn until the page script takes this class off. */
.needs-script {
  display: none;
}

/* On a phone the command box and its two buttons make one block: the command spans two rows of the grid, Copy sits in the
   first and the start control under it in the second. Two 32 px buttons and the gap between them fill the height the
   command box already has (70 px at 390 px wide), so the control adds no height to the first screen. */
.try #strip-copy {
  grid-column: 2;
  grid-row: 2;
}

.try #strip-play {
  grid-column: 2;
  grid-row: 3;
  padding-right: 0.625rem;
  padding-left: 0.625rem;
}

/* The start control is the main action of the strip. It is filled with the alive colour, ringed with a soft glow and led by a
   play mark, so it reads as the thing to press, and Copy keeps the plain accent button it always had. Dark text on the alive
   colour is far above AA contrast. On a phone the control keeps the width it had, so Copy and the command box keep theirs
   too (see the wide-screen block for the play mark). */
.try #strip-play {
  background: var(--alive);
  box-shadow: 0 0 0 2px rgba(125, 255, 179, 0.35), 0 0 8px 1px rgba(125, 255, 179, 0.35);
}

.try #strip-play:hover {
  background: #a9ffcc;
}

/* ---- The play: send the gate a false "done", then the fix, then change one byte. A box like the strip, plain flow, closed
   until the start control opens it. A result is drawn with the same rows as the receipt below: alive for PASS and a
   gravestone for FAIL, so nothing here restyles a contract row. ---- */

.play {
  scroll-margin-top: 1rem;
  min-width: 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.play > :last-child {
  margin-bottom: 0;
}

.play h3 {
  margin: 0 0 0.375rem;
  color: var(--accent);
}

.play-intro {
  margin: 0 0 0.625rem;
  font-size: 0.9375rem;
}

.diff {
  margin: 0 0 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.diff-title {
  margin: 0;
  padding: 0.375rem 0.75rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-body);
}

.diff-line {
  position: relative;
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  gap: 0 0.5rem;
  margin: 0;
  padding: 0.125rem 0.75rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.diff-line code {
  font-size: inherit;
}

.diff-mark {
  font-weight: 700;
}

.diff-del {
  color: var(--grave);
  background: rgba(255, 154, 154, 0.08);
}

.diff-add {
  color: var(--alive);
  background: rgba(125, 255, 179, 0.08);
}

/* Words for a screen reader that a sighted reader gets from the colour and the mark. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.play-steps {
  margin: 0 0 0.5rem;
  padding-left: 1.5rem;
}

.play-step {
  min-width: 0;
  margin: 0 0 0.75rem;
}

.play-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.75rem;
}

.play-step-text {
  flex: 1 1 14rem;
  min-width: 0;
  margin: 0;
  font-size: 0.9375rem;
}

.play button {
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: 0.4375rem 0.875rem;
  font-size: 0.875rem;
}

.play-result {
  margin: 0.5rem 0 0;
  padding: 0.625rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.play-result > :last-child {
  margin-bottom: 0;
}

.play-verdict {
  margin: 0 0 0.625rem;
  padding-left: 0.625rem;
  border-left: 3px solid var(--border);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.play-verdict strong {
  margin-right: 0.25rem;
}

.play-verdict.refused {
  border-left-color: var(--grave);
}

.play-verdict.refused strong {
  color: var(--grave);
}

.play-verdict.accepted {
  border-left-color: var(--alive);
}

.play-verdict.accepted strong {
  color: var(--alive);
}

.play-verdict.stopped {
  border-left-color: var(--accent);
}

.play-verdict.stopped strong {
  color: var(--accent);
}

.play-result .contracts {
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}

.play-result .note {
  white-space: pre-line;
}

.play-expected {
  margin: 0.25rem 0 0;
  color: var(--text);
}

.play-scope,
.play-full {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
}

.play-scope {
  color: var(--muted);
}

.play-receipt {
  margin: 0.75rem 0 0;
  padding-top: 0.625rem;
  border-top: 1px solid var(--line);
}

.play-receipt > p {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
}

.play-receipt .badge {
  margin: 0 0.5rem 0.5rem 0;
}

/* Both disclosures are closed to start with. Their summary lines keep the marker the browser draws, so they read as
   something to open, and they are tall enough to press. */
.play-pins summary,
.play-more summary {
  padding: 0.25rem 0;
  color: var(--link);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.play-more {
  margin-top: 0.375rem;
}

.play-message {
  margin: 0.375rem 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.play-pins .files {
  gap: 0.375rem;
  margin: 0.375rem 0 0;
}

.play-pins .file,
.play-result .file {
  padding: 0.375rem 0.625rem;
}

.play-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* ---- The result leads: the experiment result as two large counts, with the round 3 caveat in the same element. It is
   plain text in the HTML, so it reads the same without scripts. Sizes are in rem and the layout wraps, so it fits any
   system font. ---- */

.evidence {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  color: var(--muted);
}

.evidence > * {
  min-width: 0;
}

.evidence .result {
  display: block;
  color: var(--text);
  line-height: 1.2;
}

.evidence .lead {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.evidence .stat {
  display: inline-block;
  margin-right: 0.75rem;
  font-size: 0.875rem;
}

.evidence .num {
  display: inline-block;
  margin-right: 0.125rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

/* The colours carry the meaning the numbers have. 11 of 11 is the bad result (runs that said done without the gate), so it is
   drawn like a refused contract, in the gravestone colour. 0 of 19 is the good result (no false done with the gate), so it is
   drawn like a living one, in the alive colour. Both tokens are light on the dark surface, far above AA contrast. The words
   beside each number say the same thing, so colour is never the only cue. The classes name the stat, not its position. */
.evidence .stat-ungated .num {
  color: var(--grave);
}

.evidence .stat-gated .num {
  color: var(--alive);
}

.evidence .caveat {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.35;
}

/* The real-use line: one plain line of text under the header, small so the result stays in the first screen. */
.real-use {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.real-use a {
  color: var(--accent);
}

/* The size of the experiment, between the two counts and the round 3 caveat. */
.evidence .size {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.35;
}

/* The real Kiro session (Requirement 17): on its own row under the mark and the title. The quoted words are larger from 52rem up;
   the label is the link to the evidence image. Nothing in or around the figure animates or transitions. */
figure.session {
  flex: 0 0 100%;
  margin: 0;
}

figure.session figcaption {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

figure.session .session-label {
  color: var(--text);
}

@media (min-width: 52rem) {
  figure.session .session-words {
    font-size: 1.25rem;
  }
}

/* The line under the page heading that names the idea that is raised. */
.idea {
  margin: 0.125rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.35;
}

.about > :last-child {
  margin-bottom: 0;
}

/* ---- How it works: three steps, the demo command, two plain links. Plain flow, nothing moved or fixed in width. ---- */

.intro > div {
  min-width: 0;
}

.how {
  scroll-margin-top: 1rem;
}

.steps {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

.steps li {
  margin: 0 0 0.375rem;
}

.demo {
  margin: 0 0 0.5rem;
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
}

.how > :last-child {
  margin-bottom: 0;
}

/* ---- Cards and form controls ---- */

.card {
  min-width: 0;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 48px -32px rgba(0, 0, 0, 0.9);
}

label {
  display: block;
  margin: 0 0 0.375rem;
  font-weight: 600;
}

.file-label {
  display: inline-block;
  margin: 0;
  font-weight: 400;
  color: var(--muted);
}

textarea,
input[type="text"] {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 0.875rem;
  padding: 0.625rem 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

textarea {
  resize: vertical;
}

input[type="file"] {
  max-width: 100%;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.375rem 0.875rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.875rem;
  margin: 0 0 0.875rem;
}

.row > * {
  min-width: 0;
}

button {
  padding: 0.5625rem 1.125rem;
  background: var(--accent);
  color: #14101c;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #ffbb6e;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: progress;
  background: #c98a45;
}

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

.error {
  margin: 0;
  color: var(--grave);
}

.error:empty,
.notice:empty,
.summary:empty,
.muted:empty {
  display: none;
}

.notice {
  color: var(--accent);
}

/* ---- The verdict leads: Risen or Still buried, one number, one sentence. ---- */

.verdict {
  scroll-margin-top: 1rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.verdict > * {
  min-width: 0;
}

.verdict-mark {
  position: relative;
  grid-row: 1 / span 3;
  width: 2.5rem;
  height: 3.125rem;
  background: var(--stone);
  border: 2px solid var(--border);
  border-bottom-width: 4px;
  border-radius: 50% 50% 4px 4px / 38% 38% 4px 4px;
}

.verdict-mark::after {
  content: "";
  position: absolute;
}

.verdict-word {
  margin: 0;
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);
  line-height: 1.05;
}

.verdict-count {
  margin: 0.25rem 0 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.verdict-note {
  margin: 0.125rem 0 0;
  color: var(--muted);
}

.verdict.risen {
  box-shadow: inset 0 3px 0 var(--alive), 0 24px 48px -36px var(--alive);
}

.verdict.risen .verdict-word {
  color: var(--alive);
}

.verdict.risen .verdict-mark {
  border-color: var(--alive);
  box-shadow: 0 0 16px -4px var(--alive);
}

/* A checkmark on the risen stone, as in the page mark: two borders of a rotated box. */
.verdict.risen .verdict-mark::after {
  left: 36%;
  top: 24%;
  width: 28%;
  height: 44%;
  border: solid var(--alive);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.verdict.buried {
  box-shadow: inset 0 3px 0 var(--grave);
}

.verdict.buried .verdict-word {
  color: var(--grave);
}

.verdict.buried .verdict-mark {
  border-color: var(--grave);
}

/* Two engraved lines on the buried stone. */
.verdict.buried .verdict-mark::after {
  left: 28%;
  right: 28%;
  top: 40%;
  height: 2px;
  background: var(--grave);
  box-shadow: 0 0.5rem 0 var(--grave);
}

/* ---- The receipt ---- */

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.375rem 1rem;
  margin: 1.5rem 0 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.75;
}

.facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

#commit,
#receipt-hash {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.75;
}

.summary {
  font-weight: 600;
}

.group {
  margin: 1.25rem 0 0;
}

.contracts,
.files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.625rem;
}

/* A contract row is plain words: a state, a name and an optional note. Its shape is drawn here: a passing contract is
   alive, with a green edge and a soft glow; a failing one is a gravestone, with an arched top standing on the ground.
   The state word, not the color or the shape, carries the meaning. */

.contract {
  min-width: 0;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contract .state {
  margin-right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.contract .name {
  overflow-wrap: anywhere;
}

.contract .note {
  display: block;
  margin-top: 0.125rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.contract.pass {
  border-left: 3px solid var(--alive);
  box-shadow: -6px 0 18px -12px var(--alive);
}

.contract.pass .state {
  color: var(--alive);
  text-shadow: 0 0 8px rgba(125, 255, 179, 0.45);
}

.contract.fail {
  padding: 1.5rem 1rem 0.75rem;
  background: var(--stone);
  border: 1px solid var(--border);
  border-bottom: 4px solid #3d3350;
  border-radius: 50% 50% 6px 6px / 28px 28px 6px 6px;
  box-shadow: inset 0 0 0 4px var(--stone), inset 0 0 0 5px #3d3350;
}

.contract.fail .state {
  display: block;
  margin: 0 0 0.375rem;
  text-align: center;
  letter-spacing: 0.3em;
  color: var(--grave);
}

/* A failing contract that this task did not require is an unmarked plot: work not done yet, not a broken promise. */
.contract.notyet {
  background: transparent;
  border: 1px dashed var(--border);
}

.contract.notyet .state {
  color: var(--muted);
}

/* ---- Hash check, command and file check ---- */

.badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.25rem 0.875rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.badge:empty {
  display: none;
}

.hash-match {
  color: var(--alive);
  border-color: var(--alive);
}

.hash-altered {
  color: var(--grave);
  border-color: var(--grave);
}

.hash-checking {
  color: var(--muted);
}

.file {
  min-width: 0;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--border);
  border-radius: 8px;
}

.file .state {
  margin-right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.file .path {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.file .detail {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
}

.status-match {
  border-left-color: var(--alive);
}

.status-match .state {
  color: var(--alive);
}

.status-different {
  border-left: 6px solid var(--grave);
}

.status-different .state {
  color: var(--grave);
}

.status-uncommitted {
  border-left-color: var(--accent);
}

.status-uncommitted .state {
  color: var(--accent);
}

.status-unavailable {
  border-left-style: dashed;
}

.status-unavailable .state {
  color: var(--muted);
}

@media (min-width: 40rem) {
  /* Space is tight on a wide window that is not very tall (1280x800) and Ubuntu draws wider fonts than macOS, so the first
     screen spends less on padding and gaps here. A phone keeps the spacing it has above. */
  main {
    padding: 1rem 1.5rem 4rem;
    gap: 0.5rem;
  }

  /* The line that names the idea runs on from the heading, so it sits beside it and adds no line of its own. */
  .intro h1,
  .intro .idea {
    display: inline;
  }

  .intro .idea {
    margin: 0 0 0 0.5rem;
  }

  .card {
    padding: 1.5rem 1.75rem;
  }

  .verdict {
    padding: 1.125rem 1.75rem;
  }

  .play {
    padding: 0.875rem 1.75rem;
  }

  .bar,
  .strip {
    padding: 0.625rem 1.75rem;
  }

  .evidence {
    padding: 0.375rem 1.75rem;
  }

  .beats {
    margin-bottom: 0.5rem;
  }

  /* "Open your own receipt" and "How it works, and try it" share one line: the form's summary on the left, the link on the
     right. Opening the form gives it the full width and the link drops under it. Both stay in the order they have in the
     page, and neither is removed. */
  .bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 1.5rem;
    align-items: center;
  }

  .bar > * {
    grid-column: 1 / -1;
  }

  .bar > .open-own {
    grid-column: 1;
  }

  .bar > .jump {
    grid-column: 2;
    margin: 0;
  }

  .bar:has(.open-own[open]) > .open-own,
  .bar:has(.open-own[open]) > .jump {
    grid-column: 1 / -1;
  }

  .bar:has(.open-own[open]) > .jump {
    margin-top: 0.25rem;
  }

  .beats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
  }

  /* On a wide window each beat is its own small box. On a phone they are three lines with a colored edge, to keep the
     verdict banner in the first screen. */
  .beat {
    padding: 0.4375rem 0.75rem 0.4375rem 2.125rem;
    background: var(--bg);
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-radius: 8px;
  }

  .beat::before {
    left: 0.75rem;
    top: 0.4375rem;
  }

  /* The label takes its own line, then the command and its two buttons share the next one. */
  .try {
    display: flex;
    flex-wrap: wrap;
  }

  .try-label {
    flex: 0 0 100%;
  }

  /* The play mark is decoration, drawn here and not part of the label. */
  .try #strip-play::before {
    content: "\25B6\FE0E";
    margin-right: 0.375em;
    font-size: 0.75em;
  }
}

/* On a phone the first screen has to hold the real-use line, the strip and the whole result element, so the spacing above the
   result is tighter here. The text is the same; only the padding, the gaps and the size of the real-use line change. */
@media (max-width: 39.9375rem) {
  main {
    padding-top: 0.625rem;
    gap: 0.375rem;
  }

  .real-use {
    font-size: 0.8125rem;
    line-height: 1.3;
  }

  .strip {
    padding: 0.5rem 0.75rem;
  }

  .beats {
    gap: 0.125rem;
    margin-bottom: 0.375rem;
  }

  .beat {
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.3;
  }

  .beat::before {
    top: 0;
  }

  .try {
    gap: 0.25rem 0.625rem;
  }

  .evidence {
    padding: 0.375rem 0.75rem;
    gap: 0.125rem;
  }
}

/* ---- Motion, only for people who have not asked for less of it ---- */

@media (prefers-reduced-motion: no-preference) {
  /* The banner scrolls into view smoothly only when motion is welcome. */
  html {
    scroll-behavior: smooth;
  }

  @keyframes drift {
    from {
      transform: translate3d(-8%, 0, 0);
    }
    to {
      transform: translate3d(8%, 0, 0);
    }
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes breathe {
    from {
      box-shadow: 0 0 10px -6px var(--alive);
    }
    to {
      box-shadow: 0 0 22px -2px var(--alive);
    }
  }

  @keyframes draw {
    from {
      stroke-dashoffset: 30;
    }
    to {
      stroke-dashoffset: 0;
    }
  }

  .fog::before {
    animation: drift 90s ease-in-out infinite alternate;
  }

  .fog::after {
    animation: drift 140s ease-in-out infinite alternate-reverse;
  }

  .mark-check {
    stroke-dasharray: 30;
    animation: draw 1.2s ease-out 0.4s both;
  }

  .verdict {
    animation: rise 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  /* The three beats appear one after another. Under reduce they are all there at once, with no animation. */
  .beat {
    animation: rise 300ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: 0ms;
  }

  .beat:nth-child(2) {
    animation-delay: 80ms;
  }

  .beat:nth-child(3) {
    animation-delay: 160ms;
  }

  .verdict.risen .verdict-mark {
    animation: breathe 3.6s ease-in-out infinite alternate;
  }

  /* Passing contracts rise into place, a little after one another. Failing ones stay where they lie. */
  .contract.pass {
    animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .contracts > .contract:nth-child(2) {
    animation-delay: 60ms;
  }

  .contracts > .contract:nth-child(3) {
    animation-delay: 120ms;
  }

  .contracts > .contract:nth-child(4) {
    animation-delay: 180ms;
  }

  .contracts > .contract:nth-child(n + 5) {
    animation-delay: 240ms;
  }

  button {
    transition: background-color 150ms ease, transform 150ms ease;
  }
}

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

/* The receipt folded by requirement (16.2): one summary line per requirement, the rows inside. */
details.group > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
}

details.group[open] > summary {
  margin-bottom: 0.625rem;
}

#groups-toggle {
  margin: 0.5rem 0 0;
}

/* The hand-written summary of the sample, for scripts off (16.6). The page hides it once a receipt is shown. */
.static-verdict {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.static-requirements {
  margin: 0;
  padding-left: 1.25rem;
}

.static-note {
  margin: 0 0 0.25rem;
}
