/* paper.css — Living Research Artifact Template
   Apache-2.0 — see LICENSE for terms. */

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

:root {
  --prose: #1a1a1a;
  --bg: #ffffff;
  --accent: #2d5fa6;
  --demo-bg: #f6f8fa;
  --border: #d0d7de;
  --error: #cf222e;
  --mono: ui-monospace, 'Cascadia Code', 'Source Code Pro',
          Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  --serif: Georgia, 'Times New Roman', Times, serif;
  --muted: #666;
  --muted-dk: #555;
}

@media (prefers-color-scheme: dark) {
  :root {
    --prose: #e0e0e0;
    --bg: #1a1a1a;
    --accent: #6ba3d6;
    --demo-bg: #222;
    --border: #444;
    --error: #ff6b6b;
    --muted: #aaa;
    --muted-dk: #bbb;
  }
}

body {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--prose);
  background: var(--bg);
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

h1 { font-size: 1.5rem; line-height: 1.3; margin-bottom: 0.5rem; }
h2 { font-size: 1.15rem; margin-top: 2.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; }
h3 { font-size: 1rem; margin-top: 1.5rem; }

header { margin-bottom: 2rem; }
.meta  { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }

p, li { margin-bottom: 0.6rem; }
ol, ul { padding-left: 1.5rem; }
a { color: var(--accent); }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--demo-bg);
  padding: 0.15em 0.3em;
  border-radius: 3px;
}

section { overflow-x: auto; scrollbar-width: thin; }
section::-webkit-scrollbar { height: 6px; }
section::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

#claims ol { padding-left: 1.25rem; }
#claims li { margin-bottom: 0.5rem; }

.demo {
  background: var(--demo-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}
.demo h2 { border-bottom-color: var(--border); margin-top: 0; }
.claim-refs { font-size: 0.8rem; font-weight: normal; color: var(--muted); }

.demo-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
select, button {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--prose);
  cursor: pointer;
}
button:hover { background: var(--accent); color: white; border-color: var(--accent); }
button:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"] {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--prose);
  flex: 1;
  min-width: 180px;
}

.split-pane {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.pane label {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
textarea, pre.output {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem;
  background: var(--bg);
  color: var(--prose);
  resize: vertical;
  min-height: 260px;
}
pre.output {
  overflow: auto;
  scrollbar-width: thin;
  white-space: pre;
  margin: 0;
}
pre.output::-webkit-scrollbar { height: 6px; width: 6px; }
pre.output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
pre.output.error { color: var(--error); }
textarea:focus-visible, input[type="text"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.85rem;
  margin-top: 1rem;
}
.data-table th, .data-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  text-align: left;
}
.data-table th { background: var(--demo-bg); }
.data-table tr.error td { color: var(--error); }

.references {
  font-size: 0.9rem;
  line-height: 1.6;
  padding-left: 2rem;
}
.references li { margin-bottom: 0.5rem; }

#citation-block {
  background: var(--demo-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  font-size: 0.85rem;
  overflow: auto;
  scrollbar-width: thin;
}
#citation-block::-webkit-scrollbar { height: 6px; width: 6px; }
#citation-block::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}
footer a { color: var(--muted-dk); }

@media (max-width: 600px) {
  .split-pane { grid-template-columns: 1fr; }
  .demo-controls { flex-direction: column; }
}

@media print {
  .demo-controls, button, select, textarea { display: none; }
  pre.output { border: none; padding: 0; }
  .split-pane { display: block; }
  body { max-width: 100%; font-size: 11pt; color: #1a1a1a; background: #fff; }
  a { color: #2d5fa6; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.75em; }
  code { background: #f6f8fa; color: #1a1a1a; }
  .demo { background: #f6f8fa; border-color: #d0d7de; }
  pre.output.error { color: #b91c1c; }
  .data-table tr.error td { color: #b91c1c; }
  .meta, footer { color: #666; }
  footer a { color: #555; }
  h2 { border-bottom-color: #d0d7de; }
}
