:root {
  --paper: #f3eddf;
  --paper-deep: #e7ddcb;
  --paper-raised: #fbf7ee;
  --ink: #281e18;
  --muted: #66574b;
  --night: #211a17;
  --night-raised: #2d231e;
  --night-line: #5d4b3f;
  --on-night: #f2e8d8;
  --on-night-muted: #c2b39f;
  --cinnabar: #9a3829;
  --cinnabar-dark: #75241c;
  --cinnabar-soft: #efddd3;
  --copper: #b08a5e;
  --copper-ink: #7b4e2e;
  --line: #c8b99f;
  --pass: #35634f;
  --pass-soft: #dde8df;
  --warn: #7b5120;
  --warn-soft: #eaddc5;
  --font-zh: "FangSong", "STFangsong", "仿宋", "FangSong_GB2312", "Songti SC",
    "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --font-en: Baskerville, "Iowan Old Style", "Palatino Linotype", Palatino,
    "Book Antiqua", Georgia, serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ease-paper: cubic-bezier(.22, 1, .36, 1);
  --header-height: 78px;
  --footer-height: 62px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: auto;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-zh);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.82;
  letter-spacing: .018em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p,
dl,
dd,
ol,
ul {
  margin-top: 0;
}

h1,
h2,
h3,
strong {
  font-weight: 400;
}

ol,
ul {
  padding: 0;
}

.latin,
[lang="en"] {
  font-family: var(--font-en);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 8px 14px;
  background: var(--night);
  color: var(--on-night);
  transform: translateY(-160%);
}

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

:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 4px;
}

h1[tabindex="-1"]:focus-visible,
h2[tabindex="-1"]:focus-visible {
  outline: 0;
}

/* Header */
.site-header {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 4vw, 68px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--copper-ink);
  color: var(--ink);
  font-size: 27px;
  font-style: italic;
  line-height: 1;
}

.brand > span:last-child {
  display: grid;
  line-height: 1.12;
}

.brand strong {
  font-size: 23px;
  font-style: italic;
  letter-spacing: .035em;
}

.brand small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .16em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.2vw, 34px);
  font-size: 14px;
  letter-spacing: .065em;
}

.site-nav a {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.site-nav a::after {
  position: absolute;
  right: 0;
  bottom: 5px;
  left: 0;
  height: 1px;
  background: var(--cinnabar);
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms var(--ease-paper);
}

.site-nav a:hover::after,
.site-nav a.is-active::after,
.site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.site-nav a.is-active,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.site-nav a span {
  color: var(--copper-ink);
  font-family: var(--font-en);
  font-size: 12px;
  font-style: italic;
  letter-spacing: 0;
}

.site-nav .nav-source {
  padding-left: 21px;
  border-left: 1px solid var(--line);
  color: var(--ink);
  font-style: italic;
}

.site-nav .nav-experience {
  color: var(--cinnabar-dark);
}

.nav-toggle {
  display: none;
  width: 48px;
  height: 48px;
  padding: 12px;
  border: 0;
  background: transparent;
}

.nav-toggle > span:not(.sr-only) {
  display: block;
  width: 100%;
  height: 1px;
  margin: 6px 0;
  background: currentColor;
}

/* Deck */
.deck {
  min-height: calc(100svh - var(--header-height));
}

.js .deck {
  padding-bottom: var(--footer-height);
}

.deck-page {
  min-height: calc(100svh - var(--header-height) - var(--footer-height));
  background: var(--paper);
  scroll-margin-top: var(--header-height);
}

.deck-page[hidden] {
  display: none;
}

.page-shell {
  width: min(1440px, 100%);
  min-height: inherit;
  margin: 0 auto;
  padding: clamp(42px, 5vh, 72px) clamp(24px, 5vw, 80px);
}

.chapter-label {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  color: var(--copper-ink);
  font-size: 14px;
  letter-spacing: .14em;
}

.chapter-label::after {
  width: 58px;
  height: 1px;
  background: var(--copper);
  content: "";
}

.chapter-label span {
  font-family: var(--font-en);
  font-style: italic;
  letter-spacing: .04em;
}

.deck-page h1,
.deck-page h2 {
  margin-bottom: 24px;
  font-size: clamp(44px, 5vw, 76px);
  line-height: 1.17;
  letter-spacing: .04em;
}

.chapter-intro,
.overview-lead {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.9;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  border: 1px solid var(--cinnabar);
  font-size: 15px;
  letter-spacing: .055em;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button-primary {
  background: var(--cinnabar);
  color: #fffaf3;
}

.button-primary:hover {
  background: var(--cinnabar-dark);
  transform: translateY(-2px);
}

.text-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border-bottom: 1px solid var(--copper);
  font-style: italic;
}

/* Chapter 01 */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, .8fr);
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: clamp(44px, 7vw, 110px);
  row-gap: clamp(24px, 4vh, 46px);
}

.overview-copy {
  align-self: center;
}

.overview-copy h1 {
  max-width: 820px;
}

.overview-lead {
  max-width: 720px;
  margin-bottom: 29px;
}

.overview-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 34px;
}

.boundary-strip {
  display: grid;
  margin: 0;
  list-style: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.boundary-strip li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  color: var(--muted);
  font-size: 14px;
}

.boundary-strip li:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.boundary-strip li:nth-child(even) {
  padding-left: 24px;
}

.boundary-strip span {
  color: var(--copper-ink);
  font-family: var(--font-en);
  font-size: 12px;
  font-style: italic;
}

.case-sheet {
  align-self: center;
  border: 1px solid var(--night-line);
  background: var(--night);
  color: var(--on-night);
  line-height: 1.52;
}

.case-sheet-header,
.case-sheet footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 16px;
  border-color: var(--night-line);
  font-size: 12px;
  letter-spacing: .08em;
}

.case-sheet-header {
  border-bottom: 1px solid var(--night-line);
}

.case-sheet-header > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.case-sheet-header strong {
  color: var(--copper);
  font-size: 23px;
  font-style: italic;
}

.case-sheet-state {
  color: var(--on-night-muted);
}

.case-sheet-body {
  padding: clamp(18px, 2.4vw, 28px);
}

.case-sheet-label {
  margin-bottom: 7px;
  color: var(--copper);
  font-size: 12px;
  letter-spacing: .14em;
}

.case-sheet h2 {
  margin-bottom: 17px;
  font-size: clamp(24px, 2.5vw, 33px);
  line-height: 1.34;
  letter-spacing: .035em;
}

.case-sheet-meta {
  margin-bottom: 16px;
  border-top: 1px solid var(--night-line);
}

.case-sheet-meta > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  padding: 5px 0;
  border-bottom: 1px solid var(--night-line);
}

.case-sheet-meta dt {
  color: var(--on-night-muted);
}

.case-sheet-meta dd,
.case-sheet-result strong {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.case-sheet-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin-bottom: 14px;
}

.case-sheet-result > div span {
  display: block;
  color: var(--on-night-muted);
  font-size: 12px;
}

.case-sheet-result > div strong {
  color: #eaa391;
  font-size: 18px;
}

.case-sheet-result dl {
  display: flex;
  margin: 0;
  border-left: 1px solid var(--night-line);
}

.case-sheet-result dl div {
  min-width: 54px;
  padding-left: 14px;
}

.case-sheet-result dt {
  color: var(--on-night-muted);
  font-size: 11px;
}

.case-sheet-result dd {
  margin: 0;
  font-family: var(--font-en);
  font-size: 24px;
}

.case-sheet-note {
  margin-bottom: 0;
  color: var(--on-night-muted);
  font-size: 14px;
  line-height: 1.6;
}

.case-sheet footer {
  border-top: 1px solid var(--night-line);
  color: var(--on-night-muted);
}

.case-sheet footer a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  color: var(--on-night);
}

.document-index {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(210px, .55fr) 1.45fr;
  align-items: center;
  gap: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.document-index p {
  margin: 0;
  color: var(--muted);
}

.document-index ol {
  display: grid;
  margin: 0;
  list-style: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.document-index li {
  display: grid;
  min-height: 54px;
  align-content: center;
  padding: 0 16px;
  border-left: 1px solid var(--line);
  font-size: 14px;
}

.document-index li span {
  color: var(--copper-ink);
  font-family: var(--font-en);
  font-size: 11px;
  font-style: italic;
}

/* Chapter 02 */
#method {
  background: var(--night);
  color: var(--on-night);
}

.method-grid {
  display: grid;
  grid-template-columns: minmax(390px, .8fr) minmax(480px, 1.05fr);
  align-items: center;
  gap: clamp(46px, 7vw, 112px);
}

#method .method-copy h2 {
  font-size: clamp(38px, 3.6vw, 52px);
}

#method .chapter-label {
  color: var(--copper);
}

#method .chapter-intro {
  color: var(--on-night-muted);
}

.sequence-steps {
  margin: 30px 0 0;
  list-style: none;
  border-top: 1px solid var(--night-line);
}

.sequence-steps li {
  border-bottom: 1px solid var(--night-line);
}

.sequence-steps button {
  display: grid;
  width: 100%;
  min-height: 66px;
  grid-template-columns: 50px 1fr;
  align-items: center;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--on-night-muted);
  text-align: left;
  cursor: pointer;
}

.sequence-steps button > span:first-child {
  color: var(--copper);
  font-family: var(--font-en);
  font-style: italic;
}

.sequence-steps button > span:last-child {
  display: grid;
}

.sequence-steps strong {
  color: inherit;
  font-size: 18px;
}

.sequence-steps small {
  font-size: 12px;
}

.sequence-steps li.is-active button {
  color: var(--on-night);
  box-shadow: inset 2px 0 var(--cinnabar);
}

.sequence-stage {
  position: relative;
  min-height: 520px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--night-line);
  background: var(--night-raised);
}

.stage-coordinates {
  display: flex;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--night-line);
  color: var(--on-night-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0;
}

.change-chip {
  display: grid;
  width: max-content;
  max-width: 100%;
  margin: 28px auto 18px;
  padding: 9px 24px;
  border: 1px solid var(--copper);
  text-align: center;
}

.change-chip small {
  color: var(--copper);
  font-family: var(--font-en);
  font-size: 10px;
  letter-spacing: .13em;
}

.document-stack {
  position: relative;
  display: grid;
  gap: 7px;
  margin: 0 auto;
}

.document-card {
  display: grid;
  min-height: 47px;
  grid-template-columns: 45px 1fr auto;
  align-items: center;
  padding: 0 15px;
  border: 1px solid var(--night-line);
  background: var(--night);
}

.document-card span,
.document-card i {
  color: var(--on-night-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0;
}

.document-card i {
  color: #82b59c;
}

.document-card.has-conflict i {
  color: #eaa391;
}

.document-scan {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--copper);
  opacity: 0;
}

.sequence-stage[data-phase="1"] .document-scan,
.sequence-stage[data-phase="2"] .document-scan {
  opacity: .75;
  animation: document-scan 1.8s var(--ease-paper) infinite;
}

@keyframes document-scan {
  0% { transform: translateY(0); }
  100% { transform: translateY(260px); }
}

.conflict-readout,
.trust-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
  padding: 11px 14px;
  border: 1px solid var(--night-line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0;
  opacity: .3;
  transition: opacity 180ms ease, border-color 180ms ease;
}

.sequence-stage[data-phase="2"] .conflict-readout,
.sequence-stage[data-phase="3"] .conflict-readout {
  border-color: var(--cinnabar);
  opacity: 1;
}

.sequence-stage[data-phase="3"] .trust-gate {
  border-color: var(--cinnabar);
  opacity: 1;
}

.conflict-readout strong,
.trust-gate strong {
  color: #eaa391;
}

/* Chapter 03 */
.case-grid {
  display: grid;
  grid-template-columns: minmax(300px, .55fr) minmax(520px, 1.1fr);
  grid-template-rows: auto auto;
  align-content: center;
  gap: 30px clamp(48px, 7vw, 112px);
}

#case .case-intro h2 {
  font-size: clamp(38px, 3.4vw, 50px);
}

.scenario-tabs {
  margin-top: 30px;
  border-top: 1px solid var(--line);
}

.scenario-tabs button {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  gap: 15px;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.scenario-tabs button span {
  color: var(--copper-ink);
  font-family: var(--font-en);
  font-size: 13px;
  font-style: italic;
}

.scenario-tabs button[aria-selected="true"] {
  color: var(--ink);
  box-shadow: inset 2px 0 var(--cinnabar);
}

.case-static-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.demo-story {
  border: 1px solid var(--night-line);
  background: var(--night);
  color: var(--on-night);
}

.story-copy {
  padding: clamp(24px, 3vw, 40px);
}

.story-status {
  display: inline-block;
  padding: 3px 0;
  border-bottom: 1px solid #eaa391;
  color: #eaa391;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
}

.story-status.is-ready {
  border-color: #82b59c;
  color: #82b59c;
}

.story-status.is-blocked {
  border-color: #d4aa70;
  color: #d4aa70;
}

.story-copy h3 {
  max-width: 690px;
  margin: 16px 0 12px;
  font-size: clamp(26px, 3vw, 39px);
  line-height: 1.42;
  letter-spacing: .025em;
}

.story-copy p {
  color: var(--on-night-muted);
}

.story-copy ul,
.claim-boundary ul {
  margin: 20px 0 0;
  list-style: none;
}

.story-copy li,
.claim-boundary li {
  position: relative;
  padding: 6px 0 6px 24px;
}

.story-copy li::before,
.claim-boundary li::before {
  position: absolute;
  top: 1.05em;
  left: 0;
  width: 12px;
  height: 1px;
  background: var(--copper);
  content: "";
}

.story-code {
  border-top: 1px solid var(--night-line);
}

.story-code > div {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  color: var(--on-night-muted);
  font-size: 11px;
  letter-spacing: .08em;
}

.story-code [data-hash-status][data-state="matched"] {
  color: #82b59c;
}

.story-code [data-hash-status][data-state="failed"] {
  color: #eaa391;
}

.story-code pre {
  max-height: 235px;
  margin: 0;
  padding: 20px;
  overflow: auto;
  border-top: 1px solid var(--night-line);
  background: #181310;
  color: #e7dac6;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0;
}

.case-boundary {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.nojs-scenarios {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.nojs-scenarios article {
  padding: 22px 26px 22px 0;
}

.nojs-scenarios article + article {
  padding-right: 0;
  padding-left: 26px;
  border-left: 1px solid var(--line);
}

.nojs-scenarios span {
  color: var(--copper-ink);
  font-family: var(--font-mono);
  font-size: 11px;
}

.nojs-scenarios h3 {
  margin: 8px 0;
  font-size: 20px;
}

.nojs-scenarios p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Chapter 04 */
#proof {
  background: var(--paper-deep);
}

.proof-grid {
  display: grid;
  grid-template-columns: minmax(280px, .65fr) minmax(520px, 1.2fr);
  align-content: center;
  gap: clamp(28px, 4vh, 50px) clamp(48px, 7vw, 110px);
}

.proof-heading h2 {
  font-size: clamp(40px, 4.5vw, 66px);
}

.evidence-ledger {
  border-top: 1px solid var(--line);
}

.evidence-ledger article {
  display: grid;
  min-height: 104px;
  grid-template-columns: minmax(128px, .4fr) 1fr;
  align-items: center;
  gap: 26px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.evidence-ledger > article > strong {
  color: var(--cinnabar);
  font-size: clamp(31px, 3.8vw, 50px);
  font-style: italic;
  line-height: 1;
}

.evidence-ledger > article > strong.version {
  font-size: clamp(23px, 2.8vw, 37px);
}

.evidence-ledger h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.evidence-ledger p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.claim-boundary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.claim-boundary article {
  padding: 22px 28px 22px 0;
}

.claim-boundary article + article {
  padding-right: 0;
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.claim-boundary h3 {
  margin-bottom: 7px;
  font-size: 20px;
}

.claim-boundary ul {
  margin-top: 0;
  color: var(--muted);
  font-size: 14px;
}

.source-link {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
}

.source-link > div {
  display: grid;
}

.source-link span {
  color: var(--copper-ink);
  font-size: 12px;
  letter-spacing: .1em;
}

.source-link strong {
  font-size: 18px;
}

.source-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Chapter controls */
.deck-footer {
  position: fixed;
  z-index: 35;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  min-height: var(--footer-height);
  border-top: 1px solid var(--line);
  background: var(--paper-raised);
}

.js .deck-footer {
  display: block;
}

.page-meter {
  height: 2px;
  background: var(--paper-deep);
}

.page-meter span {
  display: block;
  width: calc(var(--page-progress, .25) * 100%);
  height: 100%;
  background: var(--cinnabar);
  transition: width 220ms var(--ease-paper);
}

.page-controls {
  display: grid;
  width: min(1440px, 100%);
  min-height: 59px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 80px);
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.page-controls button {
  display: inline-flex;
  min-width: 124px;
  min-height: 44px;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  letter-spacing: .06em;
}

.page-controls button:last-child {
  justify-self: end;
}

.page-controls button[disabled],
.page-controls button[aria-disabled="true"] {
  cursor: default;
  opacity: .28;
}

.page-controls p {
  margin: 0;
  font-family: var(--font-en);
  font-size: 16px;
  font-style: italic;
}

.page-controls p span:first-child {
  color: var(--cinnabar);
  font-size: 23px;
}

.noscript-note {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 80px;
  margin: 0;
  padding: 8px 12px;
  background: var(--night);
  color: var(--on-night);
  font-size: 12px;
}

/* Native directional page transitions */
[data-vt-page] {
  view-transition-name: qci-page;
}

[data-vt-case] {
  view-transition-name: qci-case;
}

[data-vt-story] {
  view-transition-name: qci-story;
}

::view-transition-old(qci-page),
::view-transition-new(qci-page) {
  animation-duration: 340ms;
  animation-timing-function: var(--ease-paper);
}

html[data-page-direction="forward"]::view-transition-old(qci-page) {
  animation-name: page-old-forward;
}

html[data-page-direction="forward"]::view-transition-new(qci-page) {
  animation-name: page-new-forward;
}

html[data-page-direction="backward"]::view-transition-old(qci-page) {
  animation-name: page-old-backward;
}

html[data-page-direction="backward"]::view-transition-new(qci-page) {
  animation-name: page-new-backward;
}

::view-transition-old(qci-case),
::view-transition-new(qci-case) {
  animation-duration: 460ms;
  animation-timing-function: var(--ease-paper);
}

::view-transition-old(qci-story),
::view-transition-new(qci-story) {
  animation-duration: 180ms;
  animation-timing-function: ease-out;
}

@keyframes page-old-forward {
  to { opacity: 0; transform: translateX(-12px); }
}

@keyframes page-new-forward {
  from { opacity: 0; transform: translateX(18px) rotateY(.6deg); }
}

@keyframes page-old-backward {
  to { opacity: 0; transform: translateX(12px); }
}

@keyframes page-new-backward {
  from { opacity: 0; transform: translateX(-18px) rotateY(-.6deg); }
}

@media (max-width: 1100px) {
  .site-nav {
    gap: 15px;
  }

  .site-nav a {
    font-size: 13px;
  }

  .overview-grid,
  .method-grid,
  .case-grid,
  .proof-grid {
    column-gap: 42px;
  }

  .overview-grid {
    grid-template-columns: minmax(0, 1fr) minmax(360px, .8fr);
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 68px;
    --footer-height: 62px;
  }

  body {
    font-size: 16px;
  }

  .site-header {
    padding: 0 20px;
  }

  .brand small {
    display: none;
  }

  .js .nav-toggle {
    display: block;
  }

  .site-nav {
    position: static;
    display: flex;
    flex: 1 1 100%;
    padding: 8px 0 14px;
    flex-wrap: wrap;
  }

  html:not(.js) .site-header {
    flex-wrap: wrap;
  }

  .js .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    align-items: stretch;
    padding: 10px 20px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--paper-raised);
    flex-direction: column;
    gap: 0;
  }

  .js .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
  }

  .site-nav .nav-source {
    padding-left: 0;
    border-left: 0;
  }

  .page-shell {
    padding: 38px 24px 42px;
  }

  .overview-grid,
  .method-grid,
  .case-grid,
  .proof-grid {
    grid-template-columns: 1fr;
    align-content: start;
  }

  .case-sheet {
    width: min(620px, 100%);
  }

  .document-index {
    grid-template-columns: 1fr;
  }

  .document-index ol {
    grid-template-columns: repeat(5, minmax(105px, 1fr));
    overflow-x: auto;
  }

  .document-index li:first-child {
    border-left: 0;
  }

  .sequence-stage {
    min-height: 500px;
  }

  .case-boundary,
  .claim-boundary,
  .source-link {
    grid-column: 1;
  }

  .proof-heading h2 br {
    display: none;
  }
}

@media (max-width: 620px) {
  .deck-page h1,
  .deck-page h2 {
    font-size: clamp(38px, 12vw, 55px);
    letter-spacing: .025em;
  }

  .overview-actions,
  .source-link {
    align-items: stretch;
    flex-direction: column;
  }

  .overview-actions .button,
  .source-link .button {
    width: 100%;
  }

  .boundary-strip {
    grid-template-columns: 1fr;
  }

  .boundary-strip li:nth-child(odd) {
    border-right: 0;
  }

  .boundary-strip li:nth-child(even) {
    padding-left: 0;
  }

  .case-sheet-header,
  .case-sheet footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .case-sheet-result {
    grid-template-columns: 1fr;
  }

  .case-sheet-result dl {
    padding-top: 12px;
    border-top: 1px solid var(--night-line);
    border-left: 0;
  }

  .case-sheet-result dl div:first-child {
    padding-left: 0;
  }

  .sequence-stage {
    min-height: 480px;
    padding: 14px;
  }

  .stage-coordinates {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-card {
    grid-template-columns: 35px 1fr auto;
  }

  .claim-boundary {
    grid-template-columns: 1fr;
  }

  .nojs-scenarios {
    grid-template-columns: 1fr;
  }

  .nojs-scenarios article,
  .nojs-scenarios article + article {
    padding: 20px 0;
    border-left: 0;
  }

  .nojs-scenarios article + article {
    border-top: 1px solid var(--line);
  }

  .claim-boundary article,
  .claim-boundary article + article {
    padding: 20px 0;
    border-left: 0;
  }

  .claim-boundary article + article {
    border-top: 1px solid var(--line);
  }

  .evidence-ledger article {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .page-controls {
    padding: 0 14px;
  }

  .page-controls button {
    min-width: 84px;
    gap: 7px;
    font-size: 14px;
  }
}

@media (max-height: 760px) and (min-width: 901px) {
  .page-shell {
    align-content: start;
    padding-top: 30px;
    padding-bottom: 35px;
  }

  .deck-page h1,
  .deck-page h2 {
    font-size: clamp(38px, 4.5vw, 60px);
  }

  .sequence-stage {
    min-height: 470px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }

  .document-scan {
    display: none;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
