/* Palette adapted from the Adversarial Deja Vu project page: light blue-gray
   canvas, white surfaces, deep academic blue, and restrained risk red. */
:root {
  color-scheme: light;
  --bg: #f7fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f8;
  --line: #dbe3ec;
  --line-strong: #b8cad8;
  --text: #223344;
  --muted: #536879;
  --subtle: #718596;
  --accent: #004b91;
  --accent-hover: #0b64ad;
  --accent-ink: #ffffff;
  --safe: #19745b;
  --unsafe: #e24d42;
  --shadow: 0 3px 10px rgba(2, 49, 78, 0.06);
  --max: 1120px;
  --reading: 700px;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

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

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

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

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

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

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

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.65rem 0.9rem;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 6px;
  transform: translateY(-150%);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(219, 227, 236, 0.95);
  background: rgba(247, 250, 252, 0.94);
  backdrop-filter: blur(12px);
}

.header-inner,
.footer-inner {
  display: flex;
  align-items: center;
  width: min(calc(100% - 48px), var(--max));
  margin: 0 auto;
}

.header-inner {
  min-height: 66px;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 24px;
  height: 27px;
  place-items: center;
  border: 2px solid var(--accent);
  clip-path: polygon(50% 0, 100% 23%, 100% 72%, 50% 100%, 0 72%, 0 23%);
}

.brand-mark i {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.brand-mark.compact {
  width: 20px;
  height: 23px;
}

.site-header nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: clamp(0.9rem, 2vw, 1.8rem);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-header nav a,
.footer-links a,
.text-button,
.section-footnote a,
.paper-meta a {
  transition: color 140ms ease;
}

.site-header nav a:hover,
.site-header nav a:focus-visible,
.footer-links a:hover,
.footer-links a:focus-visible,
.text-button:hover,
.text-button:focus-visible,
.section-footnote a:hover,
.section-footnote a:focus-visible,
.paper-meta a:hover,
.paper-meta a:focus-visible {
  color: var(--accent);
}

.header-model {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.43rem 0.72rem;
  color: var(--accent);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 650;
}

.hero,
.section {
  width: min(calc(100% - 48px), var(--max));
  margin: 0 auto;
}

.hero {
  padding: clamp(4rem, 8vw, 6rem) 0 3.5rem;
}

.hero-copy {
  max-width: 900px;
}

.eyebrow,
.section-label,
.io-kicker,
.panel-heading span,
.result-schema > span,
.evidence-box > span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 1.2rem;
}

h1 {
  max-width: 880px;
  margin-bottom: 1.35rem;
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  font-weight: 660;
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.hero-lede {
  max-width: 780px;
  margin-bottom: 1.8rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.5vw, 1.22rem);
  line-height: 1.72;
}

.hero-lede code {
  color: var(--text);
  font-size: 0.9em;
}

.hero-actions,
.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  gap: 0.8rem;
  padding: 0.65rem 0.95rem;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 650;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button.primary {
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button.secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--accent);
}

.text-button {
  color: var(--muted);
}

.io-strip {
  display: grid;
  grid-template-columns: 1fr auto minmax(170px, 0.7fr) auto 1fr;
  gap: 1.1rem;
  align-items: center;
  margin-top: 3rem;
  padding: 1.2rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.io-block,
.io-model {
  display: flex;
  min-height: 74px;
  flex-direction: column;
  justify-content: center;
}

.io-block strong,
.io-model strong {
  margin-top: 0.12rem;
  font-size: 1rem;
}

.io-block small {
  color: var(--subtle);
  font-size: 0.77rem;
}

.io-block small code {
  color: var(--safe);
}

.io-model {
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  text-align: center;
}

.io-arrow {
  color: var(--subtle);
  font-size: 1.25rem;
}

.section {
  padding: clamp(4rem, 8vw, 6rem) 0;
}

.section.ruled {
  border-top: 1px solid var(--line);
}

.section-intro {
  max-width: var(--reading);
  margin-bottom: 3rem;
}

.section-intro.compact-intro {
  margin-bottom: 2.5rem;
}

.section-label {
  margin-bottom: 0.8rem;
}

h2 {
  margin-bottom: 1.1rem;
  font-size: clamp(2.2rem, 4.6vw, 3.8rem);
  font-weight: 630;
  line-height: 1.1;
  letter-spacing: -0.045em;
}

h3 {
  margin-bottom: 0.65rem;
  font-size: 1.25rem;
  line-height: 1.3;
}

.section-intro > p:last-child,
.evidence-layout > div > p:last-child,
.guardpo-layout > div > p,
.component-list p,
.method-steps p {
  color: var(--muted);
}

.component-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.2rem;
}

.component-list article {
  padding-top: 1.3rem;
  border-top: 1px solid var(--line-strong);
}

.component-list article > span {
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.component-list h3 {
  margin-top: 1.2rem;
}

.component-list p {
  margin-bottom: 0;
  font-size: 0.94rem;
}

.evidence-layout {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: clamp(3rem, 7vw, 6rem);
  align-items: start;
  margin-top: 5rem;
}

.evidence-layout h3 {
  font-size: 1.7rem;
}

.event-schema {
  margin-bottom: 0;
  border-top: 1px solid var(--line);
}

.event-schema > div {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.event-schema dt {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--accent);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.event-schema dd {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
}

.event-schema dd span {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.principle {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
  padding: 1.3rem 1.5rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
}

.principle span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.principle p {
  margin: 0;
}

.demo-shell {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.demo-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 60px;
  padding: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.demo-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 0.82rem;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.demo-tabs button[aria-selected="true"] {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.safe-dot {
  background: var(--safe);
}

.unsafe-dot {
  background: var(--unsafe);
}

.demo-note {
  margin-left: auto;
  padding-right: 0.75rem;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 66px;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.panel-heading > div {
  display: flex;
  flex-direction: column;
}

.panel-heading strong {
  font-size: 0.94rem;
}

.copy-button {
  padding: 0.42rem 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease;
}

.copy-button:hover,
.copy-button:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.event-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-list li {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.event-list li:last-child {
  border-bottom: 0;
}

.event-role {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

.event-list strong {
  font-size: 0.9rem;
}

.event-list p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.verdict {
  min-width: 64px;
  padding: 0.28rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-align: center;
}

.verdict.safe {
  color: var(--safe);
}

.verdict.unsafe {
  color: var(--unsafe);
}

.evidence-box {
  margin: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.evidence-box ul {
  margin: 0.7rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.evidence-box li + li {
  margin-top: 0.35rem;
}

.audit-output,
.code-panel pre,
.mini-code pre,
.citation-panel pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  color: #334a5a;
  font-size: 0.78rem;
  line-height: 1.75;
}

.audit-output {
  padding: 0.25rem 1.25rem 1.4rem;
}

.copy-status {
  min-height: 0;
  margin: 0;
  padding: 0 1.2rem;
  color: var(--safe);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.copy-status:not(:empty) {
  min-height: 38px;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.install-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.install-row > div {
  min-width: 0;
}

.install-row span {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--subtle);
  font-size: 0.75rem;
}

.install-row code {
  display: block;
  overflow-x: auto;
  color: var(--text);
  font-size: 0.82rem;
  white-space: nowrap;
}

.code-layout {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 1rem;
}

.code-panel,
.mini-code,
.result-schema,
.citation-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.code-panel pre,
.mini-code pre,
.citation-panel pre {
  padding: 1.35rem;
}

.use-side {
  display: grid;
  gap: 1rem;
}

.result-schema {
  padding: 1.2rem;
}

.result-schema dl {
  margin: 0.75rem 0 0;
}

.result-schema dl > div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.8rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}

.result-schema dl > div:last-child {
  border-bottom: 0;
}

.result-schema dt {
  color: var(--accent);
  font-family: var(--mono);
}

.result-schema dd {
  margin: 0;
  color: var(--muted);
}

.protocol-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 1rem;
  border: 1px solid var(--line);
  background: var(--line);
}

.protocol-row div {
  min-height: 104px;
  padding: 1.15rem;
  background: var(--surface);
}

.protocol-row strong {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1rem;
}

.protocol-row span {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.section-footnote {
  margin: 1rem 0 0;
  color: var(--subtle);
  font-size: 0.82rem;
}

.section-footnote a,
.paper-meta a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.paper-figure {
  margin-bottom: 2.8rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.paper-figure img {
  width: 100%;
}

.paper-figure figcaption {
  display: flex;
  gap: 1rem;
  padding: 0.8rem 0.35rem 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.paper-figure figcaption span {
  color: var(--accent);
  font-family: var(--mono);
  white-space: nowrap;
}

.method-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.method-steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.7rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-strong);
}

.method-steps li > span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.method-steps p {
  margin-bottom: 0;
  font-size: 0.84rem;
}

.guardpo-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  margin-top: 5rem;
}

.guardpo-layout figure {
  margin-bottom: 0;
  padding: 0.7rem;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.guardpo-layout h3 {
  font-size: 1.8rem;
}

.plain-list {
  margin-bottom: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.plain-list li + li {
  margin-top: 0.6rem;
}

.plain-list strong {
  color: var(--text);
}

.headline-result {
  display: grid;
  grid-template-columns: 190px 190px 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.headline-result > div strong {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 500;
}

.headline-result > div span {
  color: var(--muted);
  font-size: 0.78rem;
}

.headline-result p {
  margin: 0;
  color: var(--muted);
}

.headline-result p strong {
  color: var(--text);
}

.table-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
}

.table-block {
  min-width: 0;
}

.table-block h3 {
  margin-bottom: 0.9rem;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line-strong);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

th,
td {
  padding: 0.78rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  padding-left: 0;
  text-align: left;
}

th {
  color: var(--subtle);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

td:not(:first-child) {
  color: var(--accent);
  font-family: var(--mono);
}

.paper-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(3rem, 7vw, 6rem);
  align-items: start;
}

.paper-layout h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.authors {
  color: var(--muted);
}

.paper-meta {
  margin: 2rem 0;
  border-top: 1px solid var(--line);
}

.paper-meta > div {
  display: grid;
  grid-template-columns: 92px 1fr;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}

.paper-meta dt {
  color: var(--subtle);
}

.paper-meta dd {
  margin: 0;
}

.citation-panel pre {
  white-space: pre;
}

footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  justify-content: space-between;
  gap: 2rem;
  min-height: 130px;
  color: var(--subtle);
  font-size: 0.78rem;
}

.footer-inner p {
  margin: 0;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

@media (max-width: 940px) {
  .site-header nav a:nth-child(4),
  .site-header nav a:nth-child(5) {
    display: none;
  }

  .component-list,
  .method-steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .demo-grid,
  .code-layout,
  .guardpo-layout,
  .table-grid,
  .paper-layout {
    grid-template-columns: 1fr;
  }

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

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

  .headline-result p {
    grid-column: 1 / -1;
  }

  .footer-inner {
    flex-wrap: wrap;
    padding: 2rem 0;
  }

  .footer-inner p {
    order: 3;
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 700px) {
  .header-inner,
  .footer-inner,
  .hero,
  .section {
    width: min(calc(100% - 32px), var(--max));
  }

  .site-header nav {
    display: none;
  }

  .header-inner {
    justify-content: space-between;
  }

  .hero {
    padding-top: 3.5rem;
  }

  .io-strip {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    align-items: stretch;
  }

  .io-model {
    flex-direction: row;
    justify-content: flex-start;
    padding: 0.8rem 0;
  }

  .io-arrow {
    transform: rotate(90deg);
  }

  .evidence-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .principle {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .demo-note {
    display: none;
  }

  .protocol-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .paper-figure figcaption {
    display: block;
  }

  .paper-figure figcaption span {
    display: block;
    margin-bottom: 0.25rem;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: clamp(2.35rem, 11vw, 3rem);
  }

  .hero-actions .button,
  .hero-actions .text-button,
  .paper-links .button {
    width: 100%;
  }

  .component-list,
  .method-steps,
  .headline-result {
    grid-template-columns: 1fr;
  }

  .headline-result p {
    grid-column: auto;
  }

  .event-schema dd {
    display: block;
  }

  .event-schema dd span {
    display: block;
    text-align: left;
  }

  .demo-tabs {
    align-items: stretch;
  }

  .demo-tabs button {
    flex: 1;
    justify-content: center;
    padding-inline: 0.5rem;
    font-size: 0.8rem;
  }

  .install-row {
    align-items: flex-start;
  }

  .footer-links {
    flex-wrap: wrap;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
