:root {
  color-scheme: light;
  --paper: #eef2f3;
  --ink: #102a2e;
  --teal: #226b75;
  --verified: #2e7d5b;
  --stopped: #b6533c;
  --line: #d6e0e2;
  --white: #fbfdfd;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a { color: var(--teal); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

.site-header, main { width: min(70rem, calc(100% - 2rem)); margin-inline: auto; }
.site-header { padding-block: 1.4rem; border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; gap: .65rem; align-items: center; color: var(--ink); text-decoration: none; font-weight: 650; }
.wordmark-mark { padding: .16rem .35rem; color: var(--white); background: var(--ink); font: 700 .72rem/1 ui-monospace, monospace; letter-spacing: .08em; }

main { padding-block: clamp(3.5rem, 9vw, 8rem); }
.hero { max-width: 56rem; }
.eyebrow { margin: 0 0 .8rem; color: var(--teal); font: 700 .76rem/1.2 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
h1 { max-width: 13ch; margin: 0; font: 600 clamp(3rem, 9vw, 7rem)/.92 "Iowan Old Style", Charter, Georgia, serif; letter-spacing: -.055em; }
.lede { max-width: 44rem; margin: 1.5rem 0 2.5rem; font-size: clamp(1.08rem, 2vw, 1.35rem); }

.resolver-form { padding: clamp(1.25rem, 3vw, 2rem); background: var(--white); border: 1px solid var(--line); border-left: .35rem solid var(--teal); }
.resolver-form label { display: block; margin-bottom: .55rem; font-weight: 700; }
.input-row { display: flex; gap: .75rem; }
input { min-width: 0; flex: 1; padding: .9rem 1rem; color: var(--ink); background: white; border: 1px solid #9bafb3; font: .9rem/1.4 ui-monospace, monospace; }
button { padding: .9rem 1.2rem; border: 0; color: white; background: var(--ink); font: 700 .95rem/1.2 inherit; cursor: pointer; }
button:hover { background: var(--teal); }
.input-hint { margin: .7rem 0 0; color: #52696d; font-size: .86rem; }

.trust-preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 4rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.trust-preview li { position: relative; display: grid; gap: .25rem; padding: 1rem 1rem 0 0; }
.trust-preview span { color: var(--teal); font: 700 .72rem/1 ui-monospace, monospace; }
.trust-preview small { color: #52696d; }
.result-header { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding-bottom: 2.5rem; border-bottom: 1px solid var(--ink); }
.result-header h1 { max-width: 15ch; font-size: clamp(2.6rem, 7vw, 5.5rem); }
.secondary-action { flex: none; padding: .65rem .8rem; border: 1px solid var(--ink); color: var(--ink); text-decoration: none; font-weight: 700; }
.secondary-action:hover { color: var(--white); background: var(--ink); }

.trust-chain { margin: 0; padding: 0; list-style: none; }
.trust-step { position: relative; display: grid; grid-template-columns: 4.5rem 1fr; }
.trust-step::before { position: absolute; top: 0; bottom: 0; left: 1.45rem; width: 1px; background: var(--line); content: ""; }
.trust-step:first-child::before { top: 1.45rem; }
.trust-step:last-child::before { bottom: calc(100% - 1.45rem); }
.trust-step section { min-width: 0; padding-block: 2.25rem; border-bottom: 1px solid var(--line); }
.trust-marker { position: relative; z-index: 1; display: grid; place-items: center; align-self: start; width: 2.9rem; height: 2.9rem; margin-top: 2.25rem; color: var(--white); background: var(--verified); border: .45rem solid var(--paper); border-radius: 50%; font: 700 .64rem/1 ui-monospace, monospace; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; }
.section-heading h2, .raw-section h2, .failure-panel h2, .verification-errors h2 { margin: .2rem 0 0; font: 600 clamp(1.7rem, 4vw, 2.6rem)/1.05 "Iowan Old Style", Charter, Georgia, serif; letter-spacing: -.035em; }
.stage-label { margin: 0; color: var(--teal); font: 700 .68rem/1.2 ui-monospace, monospace; letter-spacing: .11em; text-transform: uppercase; }
.status { flex: none; padding: .35rem .55rem; font: 700 .68rem/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .06em; }
.verified-status { color: #185c40; background: #d9eee3; border: 1px solid #abd3bd; }
.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.35rem 2rem; margin: 0; }
.fact-grid div, .failure-context div { min-width: 0; }
dt { margin-bottom: .25rem; color: #52696d; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
dd { margin: 0; overflow-wrap: anywhere; }
.protocol-value, code, pre { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.protocol-value { font-size: .86rem; }

.service-list { display: grid; gap: .7rem; }
.service-card { display: grid; grid-template-columns: minmax(8rem, .5fr) 1fr auto; gap: 1rem; align-items: center; padding: 1rem; color: var(--ink); background: var(--white); border: 1px solid var(--line); text-decoration: none; }
.service-card:hover { border-color: var(--teal); transform: translateX(.2rem); }
.service-type { font-weight: 750; overflow-wrap: anywhere; }
.service-url { color: #52696d; font: .78rem/1.4 ui-monospace, monospace; overflow-wrap: anywhere; }
.service-arrow { color: var(--teal); font-size: 1.25rem; }
.empty-state { padding: 1rem; background: var(--white); border: 1px dashed #9bafb3; }

.raw-section { margin: 4rem 0 0 4.5rem; }
.raw-section > p:not(.stage-label) { color: #52696d; }
.raw-document { margin-top: .8rem; background: var(--white); border: 1px solid var(--line); }
.raw-document summary { padding: 1rem; font-weight: 750; cursor: pointer; }
.raw-document pre { max-height: 28rem; margin: 0; padding: 1rem; overflow: auto; color: #dcebed; background: #143238; font-size: .78rem; white-space: pre; }

.failure-panel { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; max-width: 50rem; margin-block: 3rem 2rem; padding: clamp(1.25rem, 3vw, 2rem); background: var(--white); border-left: .35rem solid var(--stopped); }
.failure-mark { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; color: var(--white); background: var(--stopped); border-radius: 50%; font: 400 1.6rem/1 serif; }
.failure-panel .stage-label { color: var(--stopped); }
.failure-message { margin-bottom: 0; font-size: 1.08rem; }
.failure-context { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; max-width: 58rem; margin: 0; padding: 1.5rem 0; border-block: 1px solid var(--line); }
.verification-errors { max-width: 58rem; margin-top: 3rem; }
.verification-errors ul { display: grid; gap: .7rem; padding: 0; list-style: none; }
.verification-errors li { display: grid; grid-template-columns: auto 1fr; gap: .4rem .8rem; padding: 1rem; background: var(--white); border: 1px solid var(--line); }
.verification-errors code { color: var(--stopped); font-weight: 750; }
.error-path { color: #52696d; font: .75rem/1.4 ui-monospace, monospace; overflow-wrap: anywhere; }
.verification-errors p { grid-column: 1 / -1; margin: 0; }

@media (max-width: 44rem) {
  .input-row { flex-direction: column; }
  .trust-preview { grid-template-columns: 1fr 1fr; row-gap: 1.5rem; }
  .result-header { align-items: start; flex-direction: column; }
  .trust-step { grid-template-columns: 3rem 1fr; }
  .trust-step::before { left: .95rem; }
  .trust-marker { width: 2rem; height: 2rem; margin-top: 2.5rem; border-width: .3rem; }
  .section-heading { align-items: start; flex-direction: column; gap: .8rem; }
  .fact-grid, .failure-context { grid-template-columns: 1fr; }
  .service-card { grid-template-columns: 1fr auto; }
  .service-url { grid-column: 1 / -1; grid-row: 2; }
  .service-arrow { grid-column: 2; grid-row: 1; }
  .raw-section { margin-left: 3rem; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .secondary-action, .service-card { transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease; }
}
