/* Page-specific styling for the drifting identifiability formalization.
 * Shared chrome comes from ../project-base.css.
 *
 * The palette encodes claim status rather than decorating: green for what the
 * machine checked, red for what was proved false, ochre for what is open.
 * Every claim on the page carries one of the three.
 */

.fx-shell {
  --fx-proved: #2f6d55;
  --fx-refuted: #a8422f;
  --fx-open: #8a7340;
  --fx-code: #f3f4f2;
  --fx-mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, "DejaVu Sans Mono",
    "Segoe UI Mono", Menlo, Consolas, monospace;
}

/* --------------------------------------------------------------- rhythm */

.project-section {
  padding-block: clamp(2.5rem, 5vw, 4.5rem);
}

.fx-shell .section-rail span:first-child {
  color: var(--fx-proved);
}

/* ---------------------------------------------------------- typography */

.project-section-body h2 {
  margin: 0;
  max-width: 24ch;
  font-size: clamp(1.65rem, 3.6vw, 2.5rem);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.project-question h2 {
  max-width: 22ch;
}

.project-section-body h3 {
  margin: clamp(2.25rem, 4.5vw, 3.25rem) 0 0.85rem;
  font-size: clamp(1.05rem, 2.1vw, 1.28rem);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.project-section-body > p {
  max-width: 62ch;
  margin: 1.15rem 0 0;
  font-size: 0.97rem;
  line-height: 1.72;
}

.project-section-body .lede {
  max-width: 58ch;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.68;
}

.project-section-body .project-section-intro {
  max-width: 62ch;
  color: var(--muted);
}

.fx-shell .project-section .project-eyebrow {
  color: var(--fx-proved);
}

/* --------------------------------------------------------------- chips */

.chip {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.18rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  vertical-align: 0.08em;
  white-space: nowrap;
}

.chip-proved {
  color: var(--fx-proved);
}

.chip-refuted {
  color: var(--fx-refuted);
}

.chip-open {
  color: var(--fx-open);
}

.project-section-body > .fx-answer-line {
  max-width: 62ch;
  margin-top: clamp(2rem, 4vw, 2.75rem);
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 1.02rem;
}

/* ------------------------------------------------------ table of contents */

.project-toc {
  width: min(100%, calc(var(--content-width) + (2 * var(--gutter))));
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.35rem;
  margin-inline: auto;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--line);
}

.project-toc-label {
  margin-right: 0.4rem;
  color: var(--faint);
  font-size: 0.59rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.project-toc a {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 130ms ease, border-color 130ms ease;
}

.project-toc a:hover {
  color: var(--fx-proved);
  border-bottom-color: var(--fx-proved);
}

/* ---------------------------------------------------------------- hero */

/* The headline is the implication itself, typeset rather than described. */
.hero-claim {
  margin: 0.2rem 0 0;
  line-height: 1;
}

.hero-claim img {
  display: block;
  width: 100%;
  max-width: 29rem;
  height: auto;
}

.hero-claim-gloss {
  display: block;
  max-width: 30ch;
  margin-top: 1.2rem;
  color: rgba(248, 245, 237, 0.62);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.01em;
}


.hero-proof {
  min-width: 0;
}

.hero-check {
  color: var(--project-mint);
}

.hero-check::before {
  content: "✓ ";
}

.hero-code {
  margin: 0.7rem 0;
  padding: 0.95rem 1.05rem;
  border: 1px solid rgba(246, 244, 237, 0.14);
  background: rgba(8, 18, 20, 0.42);
  overflow-x: auto;
}

.hero-code code {
  font-family: var(--fx-mono);
  font-size: 0.735rem;
  line-height: 1.62;
  color: #e2e8e4;
  white-space: pre;
}

.hero-code .tok-kw {
  color: #8fc0dd;
}

.hero-code .tok-tac,
.hero-code .tok-sym {
  color: var(--project-mint);
}

.hero-code .tok-type {
  color: #e5b98a;
}

.hero-code .tok-comment {
  color: #7d8f90;
}

.hero-proof .hero-analysis-topline span:first-child,
.hero-analysis-footer .hero-metric {
  font-family: var(--fx-mono);
  font-size: 0.7rem;
  letter-spacing: 0;
  text-transform: none;
}

.project-facts code {
  font-family: var(--fx-mono);
  font-size: 0.86em;
}

/* ------------------------------------------------------------- equations */

.eq {
  margin: 1.2rem 0 0;
  padding: 0.95rem 1.1rem;
  border-left: 2px solid var(--fx-proved);
  background: var(--paper-deep);
  overflow-x: auto;
}

.eq img {
  /* the SVGs carry their own point size from one render pass, so leaving them
   * intrinsic keeps every equation at the same glyph size */
  display: block;
  width: auto;
  height: auto;
  max-width: none;
}

.eq-inline {
  margin-top: 1rem;
  padding: 0.7rem 0.85rem;
}

.eq-inline img {
  zoom: 0.86;
}

.project-section-body > .eq-note {
  max-width: 62ch;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

/* ------------------------------------------------------------- code blocks */

.code-figure {
  margin: clamp(1.5rem, 3vw, 2.25rem) 0 0;
  border: 1px solid var(--line);
  /* paper on the figure, code tone on the block itself: the caption can then
   * cap its measure without its background stopping in mid-air */
  background: var(--paper);
}

.code-figure pre {
  margin: 0;
  padding: clamp(1rem, 2.4vw, 1.4rem);
  border-bottom: 1px solid var(--line);
  background: var(--fx-code);
  overflow-x: auto;
}

.code-figure code {
  font-family: var(--fx-mono);
  font-size: 0.775rem;
  line-height: 1.68;
  color: #2f3438;
  white-space: pre;
}

.code-figure figcaption {
  max-width: 68ch;
  padding: 0.85rem clamp(1rem, 2.4vw, 1.4rem);
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.6;
}

.code-figure figcaption code {
  font-size: 0.9em;
  color: var(--ink);
}

.code-figure .tok-kw {
  color: #2f5d8a;
  font-weight: 600;
}

.code-figure .tok-tac {
  color: var(--fx-proved);
}

.code-figure .tok-type,
.code-figure .tok-num {
  color: #8a5a2f;
}

.code-figure .tok-comment {
  color: #8a9296;
}

.code-figure .tok-string {
  color: #7d6a3f;
}

.code-figure .tok-sym {
  color: #2f5d8a;
}

/* a quoted design note rather than compilable source */
.code-figure-quote {
  border-left: 3px solid var(--fx-refuted);
}

.code-figure-quote pre {
  background: var(--paper);
}

.code-figure-quote code {
  color: var(--muted);
  white-space: pre-wrap;
}

/* a terminal transcript */
.code-figure-output pre {
  background: #f7f8f6;
}

.code-figure-output code {
  white-space: pre-wrap;
}

.code-figure-output .tok-prompt {
  color: var(--faint);
}

.code-figure-output .tok-axiom {
  color: var(--fx-proved);
  font-weight: 600;
}

/* --------------------------------------------------------------- callout */

.callout {
  max-width: 62ch;
  margin-top: clamp(2rem, 4vw, 2.75rem);
  padding: clamp(1.15rem, 2.6vw, 1.6rem);
  border: 1px solid var(--line);
  border-left: 3px solid var(--fx-proved);
  background: #fbfaf6;
}

.callout-quiet {
  border-left-color: var(--project-blue);
}

.callout-refuted {
  border-left-color: var(--fx-refuted);
}

.callout p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.72;
}

.callout strong {
  color: var(--ink);
}

/* --------------------------------------------------------- the drift strip */

.drift-panel {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  background: var(--paper);
}

.drift-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: clamp(1rem, 2.5vw, 2rem);
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  border-bottom: 1px solid var(--line);
}

.field-slider-group input[type="range"] {
  width: 100%;
  margin-top: 0.35rem;
  accent-color: var(--fx-proved);
}

.legend-value {
  margin-left: 0.35rem;
  color: var(--fx-proved);
  font-variant-numeric: tabular-nums;
}

.control-hint {
  margin: 0.5rem 0 0;
  max-width: 34ch;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.field-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.field-button {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.field-button:hover {
  border-color: var(--fx-proved);
  color: var(--fx-proved);
}

.segmented-view {
  margin-top: 0.7rem;
}

.drift-figure {
  margin: 0;
  padding: clamp(0.75rem, 2vw, 1.25rem);
}

.drift-figure canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--paper);
  touch-action: none;
}

.drift-figure figcaption {
  margin-top: 0.75rem;
  max-width: 66ch;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.field-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.field-readout > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: clamp(0.85rem, 2vw, 1.15rem);
  background: var(--paper);
}

.field-readout span {
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.field-readout strong {
  font-size: clamp(1.3rem, 2.5vw, 1.62rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.field-readout strong.readout-flat {
  color: var(--fx-proved);
}

.field-readout small {
  color: var(--faint);
  font-size: 0.7rem;
}

/* ------------------------------------------------------ the proof walkthrough */

.proof-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1px;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  background: var(--line);
}

.proof-map {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0;
  padding: clamp(1.1rem, 2.6vw, 1.75rem);
  background: var(--paper);
}

.proof-map > li {
  position: relative;
  padding-left: 0;
}

/* the spine connecting one step to the next */
.proof-map > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 1.05rem;
  bottom: -0.45rem;
  width: 1px;
  height: 0.45rem;
  background: var(--line);
}

.proof-branch {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-left: 1.05rem;
  padding: 0.55rem 0 0.15rem 1.1rem;
  border-left: 1px solid var(--line);
}

.proof-branch-label {
  color: var(--faint);
  font-size: 0.58rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.proof-node {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--faint);
  background: var(--paper);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: color 130ms ease, background 130ms ease, border-color 130ms ease;
}

.proof-node:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.proof-node em {
  font-style: normal;
  font-family: var(--serif);
}

.proof-step {
  min-width: 1.5rem;
  color: var(--faint);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.proof-node-door {
  border-left-color: var(--fx-refuted);
}

.proof-node-end {
  border-left-color: var(--fx-proved);
}

.proof-node[aria-pressed="true"] {
  color: #f6f4ed;
  background: #18282b;
  border-color: #18282b;
}

.proof-node[aria-pressed="true"] .proof-step {
  color: rgba(246, 244, 237, 0.62);
}

.proof-node-door[aria-pressed="true"] {
  border-left-color: var(--fx-refuted);
}

.proof-node-end[aria-pressed="true"] {
  border-left-color: var(--project-mint);
}

.proof-detail {
  display: flex;
  flex-direction: column;
  padding: clamp(1.1rem, 2.6vw, 1.75rem);
  background: #fbfaf6;
}

.proof-detail-tag {
  margin: 0;
  color: var(--fx-proved);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.proof-detail h3 {
  margin: 0.6rem 0 0.85rem;
  font-size: 1.12rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.proof-detail p {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.proof-detail p:last-child {
  margin-bottom: 0;
}

.proof-detail .eq {
  margin-block: 0.4rem 1rem;
}

.proof-detail-file {
  margin-top: auto !important;
  padding-top: 1.1rem;
  color: var(--faint) !important;
  font-family: var(--fx-mono);
  font-size: 0.7rem !important;
  line-height: 1.7 !important;
  word-break: break-word;
}

/* ------------------------------------------------------------ the file map */

.chain-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1px;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  background: var(--line);
}

.chain-map {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: clamp(1.1rem, 2.6vw, 1.75rem);
  background: var(--paper);
}

.chain-lane {
  margin: 0.7rem 0 0.1rem;
  color: var(--faint);
  font-size: 0.58rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.chain-lane:first-child {
  margin-top: 0;
}

.chain-lane-final {
  color: var(--fx-proved);
}

.chain-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chain-node {
  flex: 0 1 auto;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-family: var(--fx-mono);
  font-size: 0.72rem;
  cursor: pointer;
  transition: color 130ms ease, background 130ms ease, border-color 130ms ease;
}

.chain-node:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.chain-node-key {
  border-bottom: 2px solid var(--project-blue);
}

.chain-node-final {
  border-bottom: 2px solid var(--fx-proved);
}

.chain-node[aria-pressed="true"] {
  color: #f6f4ed;
  background: #18282b;
  border-color: #18282b;
}

.chain-node-final[aria-pressed="true"] {
  border-bottom-color: var(--project-mint);
}

.chain-detail {
  display: flex;
  flex-direction: column;
  padding: clamp(1.1rem, 2.6vw, 1.75rem);
  background: #fbfaf6;
}

.chain-detail-tag {
  margin: 0;
  color: var(--fx-proved);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.chain-detail h3 {
  margin: 0.6rem 0 0.8rem;
  font-family: var(--fx-mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.chain-detail > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.chain-facts {
  margin: auto 0 0;
  padding-top: 1.3rem;
}

.chain-facts > div {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.chain-facts dt {
  color: var(--faint);
  font-size: 0.58rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.chain-facts dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.55;
}

.project-section-body > .after-map {
  max-width: 62ch;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ------------------------------------------------------------- the guards */

.guard-list {
  counter-reset: guard;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1px;
  margin: clamp(1.75rem, 3.5vw, 2.5rem) 0 0;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.guard-list > li {
  counter-increment: guard;
  display: flex;
  flex-direction: column;
  padding: clamp(1.2rem, 2.8vw, 1.7rem);
  background: var(--paper);
}

.guard-list > li::before {
  content: counter(guard, decimal-leading-zero);
  display: block;
  color: var(--fx-refuted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.guard-list h3 {
  margin: 0.55rem 0 0.6rem;
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.guard-list p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.68;
}

.guard-list code {
  font-family: var(--fx-mono);
  font-size: 0.88em;
  color: var(--ink);
}

.guard-status {
  margin: auto 0 0 !important;
  padding-top: 0.9rem;
  color: var(--faint) !important;
  font-size: 0.74rem !important;
}

/* ---------------------------------------------------------- findings grid */

.finding-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: clamp(2.25rem, 4.5vw, 3.25rem);
  border: 1px solid var(--line);
  background: var(--line);
}

.finding-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(1.3rem, 3vw, 1.9rem);
  border-top: 3px solid transparent;
  background: #fbfaf6;
}

.finding-card-proved {
  border-top-color: var(--fx-proved);
}

.finding-card-open {
  border-top-color: var(--fx-open);
}

.finding-status {
  margin: 0 0 0.8rem;
}

.finding-card h3 {
  margin: 0 0 0.7rem;
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.finding-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.7;
}

.project-aside {
  margin-top: clamp(2rem, 4vw, 2.75rem);
  padding: clamp(1.2rem, 2.8vw, 1.75rem);
  border-left: 2px solid var(--fx-proved);
  background: var(--paper-deep);
}

.project-aside .project-eyebrow {
  margin: 0;
}

.project-aside p + p {
  max-width: 62ch;
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.89rem;
  line-height: 1.7;
}

/* ------------------------------------------------------------ references */

.refs {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.refs h3 {
  margin: 1.75rem 0 0.7rem;
  color: var(--faint);
  font-size: 0.59rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.refs h3:first-child {
  margin-top: 0;
}

.refs p {
  max-width: 66ch;
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.65;
}

.refs a {
  color: var(--fx-proved);
}

.refs-note {
  color: var(--faint);
}

/* -------------------------------------------------------- call to action */

.project-cta {
  padding-block: clamp(3.25rem, 6vw, 5.5rem);
}

.project-cta h2 {
  margin-inline: 0 auto;
  max-width: 28ch;
  font-size: clamp(1.65rem, 3.6vw, 2.5rem);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.project-cta-links {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 980px) {
  .proof-wrap,
  .chain-wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .finding-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-cta-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .finding-grid,
  .project-cta-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .drift-controls {
    grid-template-columns: 1fr;
  }

  .eq {
    padding: 0.8rem 0.85rem;
  }

  .eq img {
    zoom: 0.85;
  }

  .code-figure code,
  .hero-code code {
    font-size: 0.7rem;
  }

  .chain-facts > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }
}

@media print {
  .project-toc,
  .drift-panel,
  .proof-wrap,
  .chain-wrap {
    display: none;
  }
}
