davinci-paper/v3-pq/index.html
v3-pq/index.htmlRaw
1<!DOCTYPE html>
2<html lang="en" data-color-mode="light" data-light-theme="light" data-dark-theme="light">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <meta name="color-scheme" content="only light">
7 <title>DAVINCI v3-PQ — Post-Quantum Protocol Specification</title>
8 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@5.8.1/github-markdown-light.min.css" integrity="sha384-y0W3M22ACdv+yTWx1gSgw8yRa++DRY7bp/LjeFT6Wz8Sawsr//4qb5BDQxsq+xJx" crossorigin="anonymous">
9 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">
10 <style>
11 :root {
12 color-scheme: light;
13 --fgColor-default: #1f2328;
14 --fgColor-muted: #57606a;
15 --fgColor-accent: #0969da;
16 --bgColor-default: #ffffff;
17 --bgColor-muted: #f6f8fa;
18 --borderColor-default: #d0d7de;
19 }
20 body {
21 margin: 0;
22 background: linear-gradient(180deg, #eef2f7 0%, #f6f8fa 30%, #f6f8fa 100%);
23 color: #1f2328;
24 }
25 .topbar {
26 position: sticky;
27 top: 0;
28 z-index: 2;
29 display: flex;
30 flex-wrap: wrap;
31 gap: 12px;
32 align-items: center;
33 padding: 12px 16px;
34 border-bottom: 1px solid #d0d7de;
35 background: rgba(255, 255, 255, 0.95);
36 backdrop-filter: blur(4px);
37 }
38 .topbar > a,
39 .topbar > button {
40 text-decoration: none;
41 border: 1px solid #d0d7de;
42 border-radius: 6px;
43 padding: 6px 10px;
44 color: #1f2328;
45 background: #f6f8fa;
46 font: 600 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
47 }
48 .topbar > button { cursor: pointer; }
49 #toc {
50 position: absolute;
51 top: 100%;
52 left: 16px;
53 right: 16px;
54 max-width: 600px;
55 max-height: 65vh;
56 overflow-y: auto;
57 padding: 16px;
58 border: 1px solid #d0d7de;
59 border-radius: 8px;
60 background: #fff;
61 box-shadow: 0 10px 24px rgba(31, 35, 40, 0.15);
62 font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
63 }
64 #toc ol { list-style: none; margin: 0; padding: 0; }
65 #toc a {
66 display: block;
67 padding: 5px 8px;
68 padding-left: calc(8px + var(--toc-depth) * 16px);
69 color: #0969da;
70 text-decoration: none;
71 border-radius: 4px;
72 }
73 #toc a:hover, #toc a:focus-visible { background: #f6f8fa; }
74 .markdown-body :is(h1, h2, h3, h4, h5, h6) {
75 scroll-margin-top: calc(var(--topbar-height, 80px) + 16px);
76 }
77 .markdown-body {
78 box-sizing: border-box;
79 min-width: 200px;
80 max-width: 980px;
81 margin: 14px auto 24px;
82 padding: 30px 28px 40px;
83 background: #fff;
84 border: 1px solid #d0d7de;
85 border-radius: 10px;
86 box-shadow: 0 10px 24px rgba(31, 35, 40, 0.07);
87 color: #1f2328 !important;
88 font-size: 17px;
89 line-height: 1.72;
90 }
91 .markdown-body p,
92 .markdown-body li,
93 .markdown-body blockquote,
94 .markdown-body td,
95 .markdown-body th {
96 color: #1f2328 !important;
97 }
98 .markdown-body h1,
99 .markdown-body h2,
100 .markdown-body h3 {
101 color: #0f172a !important;
102 letter-spacing: -0.01em;
103 }
104 .markdown-body a {
105 color: #0969da !important;
106 }
107 .markdown-body code {
108 color: #0550ae;
109 background: #f6f8fa;
110 }
111 .markdown-body pre {
112 background: #f6f8fa;
113 border: 1px solid #d0d7de;
114 border-radius: 8px;
115 }
116 .markdown-body img {
117 max-width: 100% !important;
118 height: auto !important;
119 display: block;
120 margin: 1.2rem auto;
121 border-radius: 6px;
122 cursor: zoom-in;
123 }
124 #lightbox {
125 position: fixed;
126 inset: 0;
127 z-index: 10;
128 display: none;
129 background: rgba(15, 23, 42, 0.92);
130 overflow: auto;
131 text-align: center;
132 cursor: zoom-out;
133 }
134 #lightbox.open { display: block; }
135 #lightbox img {
136 display: block;
137 margin: auto;
138 position: absolute;
139 inset: 0;
140 max-width: 94vw;
141 max-height: 94vh;
142 background: #fff;
143 border-radius: 8px;
144 padding: 14px;
145 box-sizing: border-box;
146 cursor: zoom-in;
147 }
148 #lightbox.zoomed { cursor: zoom-out; }
149 #lightbox.zoomed img {
150 position: static;
151 margin: 3vh auto;
152 max-width: none;
153 max-height: none;
154 width: 170vw;
155 cursor: zoom-out;
156 }
157 #lightbox .lb-hint {
158 position: fixed;
159 bottom: 14px;
160 left: 50%;
161 transform: translateX(-50%);
162 color: #e2e8f0;
163 font: 500 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
164 background: rgba(15, 23, 42, 0.75);
165 border-radius: 999px;
166 padding: 6px 14px;
167 pointer-events: none;
168 }
169 #status {
170 margin-left: auto;
171 font: 500 13px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
172 color: #57606a;
173 }
174 @media (max-width: 767px) {
175 .markdown-body {
176 margin: 0;
177 border-radius: 0;
178 border-left: none;
179 border-right: none;
180 padding: 22px 16px 30px;
181 font-size: 16px;
182 }
183 }
184 .markdown-body table th, .markdown-body table td { background: #ffffff !important; }
185 .markdown-body table tr:nth-child(2n) td { background: #f6f8fa !important; }
186 .markdown-body table th { background: #f6f8fa !important; }
187 </style>
188</head>
189<body>
190 <div class="topbar">
191 <a href="../">DAVINCI v2 spec</a>
192 <a href="spec.md" download>Download spec.md</a>
193 <a href="spec.md" target="_blank" rel="noopener noreferrer">Raw markdown</a>
194 <button id="toc-toggle" type="button" aria-expanded="false" aria-controls="toc" disabled>Table of contents</button>
195 <span id="status">Loading…</span>
196 <nav id="toc" aria-label="Table of contents" hidden>
197 <ol id="toc-list"></ol>
198 </nav>
199 </div>
200 <article id="content" class="markdown-body"></article>
201 <div id="lightbox" role="dialog" aria-modal="true" aria-label="Image viewer">
202 <img id="lightbox-img" src="" alt="">
203 <div class="lb-hint">click image to zoom · click outside or press Esc to close</div>
204 </div>
205 <script src="https://cdn.jsdelivr.net/npm/marked@15.0.12/lib/marked.umd.min.js" integrity="sha384-zCewoQXXb5Xf+2nvCjab0EbMl7FWVpJMsKyrc8M8DqxjFra4DY4XHwheVdHXa34k" crossorigin="anonymous"></script>
206 <script src="https://cdn.jsdelivr.net/npm/dompurify@3.1.7/dist/purify.min.js" integrity="sha384-XQqX/4yiUGu+oyr87jvWzRuqBUK/adrY0DunhL+tID9m/9dwSpV8h9Fk/Sg6ifVQ" crossorigin="anonymous"></script>
207 <script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>
208 <script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"></script>
209 <script>
210 (async () => {
211 const status = document.getElementById('status');
212 const content = document.getElementById('content');
213 try {
214 const response = await fetch('spec.md', { cache: 'no-store' });
215 if (!response.ok) throw new Error('HTTP ' + response.status);
216 const md = await response.text();
217 marked.setOptions({ gfm: true, breaks: false });
218 const math = [];
219 const protectedMd = md.replace(/\$\$[\s\S]+?\$\$|\$[^\n$]+?\$/g, (m) => {
220 math.push(m);
221 return '@@MATH' + (math.length - 1) + '@@';
222 });
223 let html = DOMPurify.sanitize(marked.parse(protectedMd));
224 html = html.replace(/@@MATH(\d+)@@/g, (_, i) =>
225 math[+i].replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'));
226 content.innerHTML = html;
227 const tocToggle = document.getElementById('toc-toggle');
228 const toc = document.getElementById('toc');
229 const tocList = document.getElementById('toc-list');
230 const usedIds = new Set(Array.from(document.querySelectorAll('[id]'), el => el.id));
231 // Build navigation from rendered headings, keeping duplicate titles distinct.
232 content.querySelectorAll('h1, h2, h3, h4, h5, h6').forEach((heading) => {
233 const title = heading.textContent.trim();
234 if (!heading.id) {
235 const base = title.toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu, '').trim().replace(/\s+/g, '-') || 'section';
236 let id = base;
237 let suffix = 1;
238 while (usedIds.has(id)) id = base + '-' + suffix++;
239 heading.id = id;
240 usedIds.add(id);
241 }
242 const item = document.createElement('li');
243 const link = document.createElement('a');
244 link.href = '#' + encodeURIComponent(heading.id);
245 link.textContent = title;
246 link.style.setProperty('--toc-depth', Number(heading.tagName.slice(1)) - 1);
247 item.append(link);
248 tocList.append(item);
249 });
250 const closeToc = () => {
251 toc.hidden = true;
252 tocToggle.setAttribute('aria-expanded', 'false');
253 };
254 tocToggle.disabled = !tocList.children.length;
255 tocToggle.addEventListener('click', () => {
256 toc.hidden = !toc.hidden;
257 tocToggle.setAttribute('aria-expanded', String(!toc.hidden));
258 });
259 toc.addEventListener('click', (event) => {
260 const link = event.target.closest('a');
261 if (!link) return;
262 closeToc();
263 const heading = document.getElementById(decodeURIComponent(link.hash.slice(1)));
264 heading.setAttribute('tabindex', '-1');
265 heading.focus({ preventScroll: true });
266 });
267 document.addEventListener('click', (event) => {
268 if (!toc.contains(event.target) && !tocToggle.contains(event.target)) closeToc();
269 });
270 document.addEventListener('keydown', (event) => {
271 if (event.key === 'Escape' && !toc.hidden) {
272 closeToc();
273 tocToggle.focus();
274 }
275 });
276 const topbar = document.querySelector('.topbar');
277 new ResizeObserver(() => {
278 document.documentElement.style.setProperty('--topbar-height', topbar.offsetHeight + 'px');
279 }).observe(topbar);
280 if (window.renderMathInElement) {
281 window.renderMathInElement(content, {
282 throwOnError: false,
283 delimiters: [
284 { left: '$$', right: '$$', display: true },
285 { left: '$', right: '$', display: false }
286 ]
287 });
288 }
289 status.textContent = 'DAVINCI v3-PQ · draft';
290
291 const lightbox = document.getElementById('lightbox');
292 const lightboxImg = document.getElementById('lightbox-img');
293 const closeLightbox = () => {
294 lightbox.classList.remove('open', 'zoomed');
295 lightboxImg.src = '';
296 document.body.style.overflow = '';
297 };
298 content.addEventListener('click', (e) => {
299 const img = e.target.closest('img');
300 if (!img) return;
301 lightboxImg.src = img.src;
302 lightboxImg.alt = img.alt || '';
303 lightbox.classList.add('open');
304 document.body.style.overflow = 'hidden';
305 });
306 lightbox.addEventListener('click', (e) => {
307 if (e.target === lightboxImg) {
308 lightbox.classList.toggle('zoomed');
309 if (!lightbox.classList.contains('zoomed')) lightbox.scrollTo(0, 0);
310 } else {
311 closeLightbox();
312 }
313 });
314 document.addEventListener('keydown', (e) => {
315 if (e.key === 'Escape' && lightbox.classList.contains('open')) closeLightbox();
316 });
317 } catch (err) {
318 status.textContent = 'Failed to load spec';
319 content.innerHTML = '<p>Unable to render <code>spec.md</code>: ' + err.message + '</p>';
320 }
321 })();
322 </script>
323</body>
324</html>