Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
319 lines (300 loc) · 40.1 KB
/
Copy pathindex.html
File metadata and controls
319 lines (300 loc) · 40.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<!doctype html><!-- Comb Code, Copyright (c) 2026 Avi Shor. Free to use, with or without credit. See LICENSE.md. No warranty. --><html lang="en"><head><meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' https://www.googletagmanager.com 'unsafe-inline' 'wasm-unsafe-eval' blob:; worker-src 'self' blob:; style-src 'self' 'unsafe-inline'; img-src 'self' https://www.googletagmanager.com https://*.google-analytics.com data: blob:; font-src 'self' data:; connect-src 'self' https://www.googletagmanager.com https://*.google-analytics.com https://*.analytics.google.com https://combcode-stats.avishorwork.workers.dev data: blob:; media-src 'self' blob: data:; object-src 'none'; base-uri 'self'; form-action 'self'">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-G28TD2G4VG"></script>
<script>(function(){try{var q=location.search;if(/[?&]cc_me=1/.test(q))localStorage.setItem('cc_me','1');if(/[?&]cc_me=0/.test(q))localStorage.removeItem('cc_me');if(localStorage.getItem('cc_me')==='1'){window['ga-disable-G-G28TD2G4VG']=true;return}var v=localStorage.getItem('cc_v');if(!v){v=Math.random().toString(36).slice(2)+Date.now().toString(36);localStorage.setItem('cc_v',v)}var u='https://combcode-stats.avishorwork.workers.dev/hit';function s(t){if(t==='ping'&&document.visibilityState==='hidden')return;fetch(u,{method:'POST',mode:'no-cors',keepalive:true,headers:{'Content-Type':'text/plain'},body:JSON.stringify({v:v,t:t,p:location.pathname})}).catch(function(){})}s('view');setInterval(function(){s('ping')},20000)}catch(e){}})()</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-G28TD2G4VG');
</script>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#ffffff"><link rel="manifest" href="manifest.webmanifest"><link rel="icon" href="brand/icon-32.png"><link rel="apple-touch-icon" href="brand/icon-180.png"><link rel="stylesheet" href="site.css"><meta name="description" content="Comb Code: a color 2D code you can scan, lock with a password and sign. Free, offline, reads on your device."><title>Comb Code</title><style>
:root{--ink:#1b1b1b;--muted:#6b6567;--gray:#f5f3f2;--line:#E2E2E4;--blue:#2E5BFF;--blue2:#2250ec;--green:#367464}
*{box-sizing:border-box}html{scroll-behavior:smooth}[hidden]{display:none!important}
body{margin:0;font:400 17px/1.55 Poppins,system-ui,sans-serif;color:var(--ink);background:#fff;-webkit-font-smoothing:antialiased}
a{color:var(--blue);text-decoration:none}a:hover{text-decoration:underline}
h1,h2,h3{margin:0;font-weight:700;letter-spacing:-.025em;line-height:1.08}
.in{max-width:1024px;margin:0 auto}
.hero{text-align:center;padding:84px 22px 0;max-width:1024px;margin:0 auto}
.eyebrow{display:inline-block;font-size:13px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;margin-bottom:18px;background:linear-gradient(90deg,#D7263D,#F77F00,#F5C518,#2DB35A,#00B8D9,#2E5BFF,#B5179E);-webkit-background-clip:text;background-clip:text;color:transparent}
.hero h1{font-size:clamp(40px,6.6vw,80px);letter-spacing:-.032em;line-height:1.04}
.sub{font-size:clamp(18px,2.3vw,23px);line-height:1.4;color:var(--muted);max-width:620px;margin:22px auto 0}
.cta-row{display:flex;gap:10px 18px;justify-content:center;align-items:center;margin-top:34px;flex-wrap:wrap}
.btn{display:inline-block;border-radius:980px;font:600 17px Poppins,system-ui,sans-serif;padding:14px 30px;transition:background .18s ease,transform .18s ease;border:0;cursor:pointer}
.btn:hover{text-decoration:none}.btn-pri{background:var(--blue);color:#fff}.btn-pri:hover{background:var(--blue2)}
.btn-sec{color:var(--blue);padding:14px 6px;background:none}.btn-sec::after{content:" \203a"}
.btn-wh{background:#fff;color:var(--ink)}
.hv{margin:60px auto 0;max-width:820px;border-radius:32px;background:var(--gray);padding:clamp(26px,5vw,60px);display:flex;justify-content:center}
.hv img{width:min(400px,70vw);height:auto;border-radius:18px;box-shadow:0 24px 60px rgba(0,0,0,.13);background:#fff}
section.b{padding:clamp(80px,10vw,140px) 22px}.tint{background:var(--gray)}.center{text-align:center}
.k{font-size:clamp(28px,4.2vw,46px);letter-spacing:-.028em}
.lede{font-size:clamp(17px,2vw,20px);line-height:1.5;color:var(--muted);max-width:600px;margin:18px auto 0}
.steps{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:52px;text-align:left}
.step{background:var(--gray);border-radius:26px;padding:30px 26px}.tint .step{background:#fff}
.step i{font-style:normal;font-size:13px;font-weight:700;letter-spacing:.08em;color:#9a9294}
.step h3{font-size:21px;margin:10px 0 8px}.step p{font-size:15.5px;line-height:1.5;color:var(--muted);margin:0}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:18px;margin-top:52px}
.stat{background:#fff;border-radius:26px;padding:34px 24px;text-align:center}
.stat b{display:block;font-size:clamp(34px,4.4vw,50px);font-weight:700;letter-spacing:-.03em;line-height:1}
.stat span{display:block;margin-top:12px;font-size:14px;color:var(--muted);line-height:1.45}
.cmp{margin:34px auto 0;max-width:760px;text-align:left;background:#fff;border-radius:26px;overflow:hidden}
.cmp table{border-collapse:collapse;width:100%;font-size:15px}.cmp th,.cmp td{padding:13px 18px;text-align:left;border-bottom:1px solid var(--line);vertical-align:top}.cmp tr:last-child td{border:0}
.cmp th{font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:600}.cmp td b{font-weight:600}
.fine{font-size:14px;color:var(--muted);max-width:640px;margin:22px auto 0;line-height:1.55}
.dark{background:#000;color:#f5f5f7}.dark .lede{color:#a1a1a6}.dark .fine{color:#86868b}
.split{display:grid;grid-template-columns:1fr 1fr;gap:clamp(30px,6vw,90px);align-items:center;text-align:left}
.split .k{font-size:clamp(30px,4vw,46px)}.split .lede{margin:16px 0 0}.split a.more{display:inline-block;margin-top:20px;font-weight:600;color:#6c8cff}.split a.more::after{content:" \203a"}
.split img{width:min(260px,70%);margin:0 auto;display:block}
.plan{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:44px;text-align:left}
.plan div{background:var(--gray);border-radius:24px;padding:24px}.plan span{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#7a7476}.plan h3{font-size:19px;margin:8px 0 6px}.plan p{font-size:15px;margin:0;color:var(--muted)}
.js .rv{opacity:0;transform:translateY(22px);transition:opacity .7s ease,transform .7s cubic-bezier(.2,.8,.2,1)}.js .rv.on{opacity:1;transform:none}
#secure{opacity:1!important;transform:none!important;transition:none!important}
@media(max-width:760px){.hero{padding-top:52px}.hv{margin-top:40px;border-radius:24px}.steps,.stats,.plan{grid-template-columns:1fr;gap:12px;margin-top:36px}.split{grid-template-columns:1fr;text-align:center}.split .lede{margin-left:auto;margin-right:auto}.split img{width:min(170px,50%);order:-1}.cmp td,.cmp th{padding:11px 12px;font-size:14px}section.b{padding:72px 20px}.btn{padding:14px 26px}.cta-row .btn-pri{width:100%;max-width:340px;text-align:center}}
@media(prefers-reduced-motion:reduce){.js .rv{opacity:1!important;transform:none!important;transition:none!important}html{scroll-behavior:auto}}
</style><link rel="stylesheet" href="comb-creator.css"><link rel="stylesheet" href="a11y.css"><link rel="stylesheet" href="controls-motion.css"><meta property="og:type" content="website"><meta property="og:title" content="Comb Code"><meta property="og:description" content="A color code that holds more."><meta property="og:url" content="https://getcombcode.github.io/"><meta property="og:image" content="https://getcombcode.github.io/brand/share-banner-1200x630.png?v=2"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="Comb Code"><meta name="twitter:description" content="A color code that holds more."><meta name="twitter:image" content="https://getcombcode.github.io/brand/share-banner-1200x630.png?v=2"></head><body><div class="sbstrip"><i style="background:#D7263D"></i><i style="background:#F77F00"></i><i style="background:#F5C518"></i><i style="background:#2DB35A"></i><i style="background:#00B8D9"></i><i style="background:#2E5BFF"></i><i style="background:#B5179E"></i></div><div class="sitebar"><div class="sb-in"><a class="brand" href="index.html" aria-label="Comb Code home"><img class="full" src="brand/logo-horizontal.png" alt="Comb Code"><img class="ic" src="brand/icon-192.png" alt=""></a><div class="sl"><a href="index.html" aria-current="page">Home</a><a href="use.html">Use</a><a href="comb.html">Advanced</a><a href="docs.html">Docs</a></div><a class="scanpill" href="scan.html"><span class="l">Scan a code</span><span class="s">Scan</span></a></div></div>
<style>
/* ---- Comb home hero with blueprint pull-apart. Uses the site's variables (--ink, --muted, --gray, --blue) and Poppins. ---- */
.phero{text-align:center;padding:44px 22px 0;max-width:1024px;margin:0 auto}
.phero .eyebrow{display:inline-block;font-size:13px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;margin-bottom:18px;background:linear-gradient(90deg,#D7263D,#F77F00,#F5C518,#2DB35A,#00B8D9,#2E5BFF,#B5179E);-webkit-background-clip:text;background-clip:text;color:transparent}
.phero h1{font-size:clamp(40px,5.4vw,64px);letter-spacing:-.032em;line-height:1.04}
.phero .sub{font-size:clamp(18px,2.3vw,23px);line-height:1.4;color:var(--muted);max-width:620px;margin:22px auto 0}
.phero .cta-row{display:flex;gap:10px 18px;justify-content:center;align-items:center;margin-top:34px;flex-wrap:wrap}
.ph-panel{margin:34px auto 0;max-width:1024px;border-radius:32px;background:#030d22;padding:clamp(10px,2vw,18px);box-shadow:0 30px 70px rgba(10,30,70,.22);text-align:left}
.ph-panel canvas{display:block;width:100%;border-radius:22px;background:#071d42}
#phLegend{list-style:none;margin:12px 0 2px;padding:0;display:grid;grid-template-columns:repeat(5,1fr);gap:8px}
#phLegend li{display:flex;flex-direction:column;gap:2px;padding:9px 12px;border:1px solid rgba(150,205,255,.2);border-radius:14px;color:#a9c4e6;font:500 13px/1.25 Poppins,system-ui,sans-serif;transition:border-color .25s,background .25s,color .25s}
#phLegend li b{font:400 11.5px ui-monospace,Menlo,monospace;color:#7ea6d6}
#phLegend li.on{border-color:#2fe6ff;color:#fff;background:rgba(47,230,255,.1)}
#phLegend li:nth-child(2).on{border-color:#ffd24a;background:rgba(255,210,74,.1)}
.ph-note{font-size:13px;color:#7ea6d6;margin:10px 4px 2px;line-height:1.5}
.ph-how .steps{grid-template-columns:repeat(4,1fr)}
@media(max-width:900px){#phLegend{grid-template-columns:repeat(2,1fr)}.ph-how .steps{grid-template-columns:repeat(2,1fr)}}
@media(max-width:760px){.phero{display:flex;flex-direction:column;padding-top:26px}.phero .eyebrow{order:0;margin-bottom:10px}.phero h1{order:1;font-size:clamp(30px,9vw,40px)}.phero .ph-panel{order:2;margin-top:18px;border-radius:24px}.phero .sub{order:3;margin-top:22px}.phero .cta-row{order:4}.ph-how .steps{grid-template-columns:1fr}}
</style>
<header class="phero"><span class="eyebrow">Comb Code</span><h1>A color code you can scan, lock and sign.</h1>
<div class="ph-panel" role="group" aria-label="Animation: how a Comb code is built">
<canvas id="phCanvas" role="img" aria-label="Animation: a real 21 by 24 Comb Code on a white card is scanned, lifts apart into five glass layers (data, error correction, header, guide cells and border, orientation pattern), repairs four damaged cells with gold beams, then rejoins."></canvas>
<ul id="phLegend"><li>Data<b>227 cells</b></li><li>Error correction<b>96 cells</b></li><li>Header<b>72 cells</b></li><li>Guide cells + border<b>100 cells</b></li><li>Orientation pattern<b>9 cells</b></li></ul>
<p class="ph-note">A real 21 x 24 code, 504 cells, each one of 8 colors (3 bits). Cell positions, colors, counts and layer roles are the real encoder output. The damage and the beam paths are illustrative. The corner cells are filled with a fixed pattern, as the current encoder does.</p></div>
<p class="sub">Comb turns a message or a link into colored hexagons. Free, offline, and it reads on your own device.</p>
<div class="cta-row"><a class="btn btn-pri" href="use.html">Make your own</a></div></header>
<section class="b tint center ph-how"><div class="in"><h2 class="k">How a scan reads a code.</h2><p class="lede">Eight steps, all on your device.</p>
<div class="steps"><div class="step"><i>01</i><h3>Take a photo</h3><p>Or grab a camera frame.</p></div><div class="step"><i>02</i><h3>Find the code</h3><p>Separate it from the background.</p></div><div class="step"><i>03</i><h3>Straighten it</h3><p>The border, guide cells and orientation pattern fix perspective and bending.</p></div><div class="step"><i>04</i><h3>Calibrate colors</h3><p>Guide cells have known colors, so tinted light still reads true.</p></div><div class="step"><i>05</i><h3>Read the cells</h3><p>Each color becomes a 3-bit number.</p></div><div class="step"><i>06</i><h3>Read the header</h3><p>Three copies, and the majority wins.</p></div><div class="step"><i>07</i><h3>Repair</h3><p>Un-shuffle the cells, then error correction fixes damaged numbers.</p></div><div class="step"><i>08</i><h3>Check it</h3><p>A 4-byte check number must match, or the reader says try again. It never shows a guess.</p></div></div></div></section>
<script>
(()=>{
const cv=document.getElementById('phCanvas'),ctx=cv.getContext('2d');
const RM={matches:false,addEventListener(){}}; /* hero animation always plays */
const C=21,R=24,LOOP=20,S3=Math.sqrt(3),MONO='ui-monospace,Menlo,Consolas,monospace',SANS='Poppins,system-ui,-apple-system,Segoe UI,sans-serif';
const ROLE='444333333333333333333444002010002001021003444012031102310003023300102000112000020103310200002000002100023310110210002100112013300211001201002010023313000032100312013113302000121000121000203310002010020001121003302000102010020000023300102000112011020013303120031020310003203311120110120100200003302001020000020000203311012101020000120003302000012001021010023303100230010320003003321100200011210002103300021110210000201003320000020011200100203300020000021010201013313211031210300023013333333333333333333333',NUM='025164370251643702516702118523728123581161370320336178601505385427618650058173283262603872338767148327780114323825600540508507560033731072548307683232502370314448670704070152306541482230806720018121404242183461338406148245786675785415638545558316485152675086482787132032040171085375406276033457568423687450604063803252500356202105787664028662278315507433286750732833432681715031382664812265865508505430281154832661817452605730383377004234070173282653284223033567532835672000404600413251643702516437025164',ORDER=[424,368,313,76,342,25,257,238,48,480,433,442,96,297,372,386,346,361,114,78,332,393,178,67,60,221,366,94,200,138,334,77,235,173,397,411,30,172,333,354,153,70,144,477,101,233,382,450,133,444,300,341,339,358,468,132,443,198,453,152,102,56,246,136,311,89,31,228,387,193,348,309,243,392,64,225,373,185,278,127,268,219,324,69,286,291,177,93,428,207,187,65,413,171,57,385,345,118,287,340,224,351,237,318,400,328,306,40,143,150,217,417,29,75,34,337,439,258,184,226,437,90,214,80,123,434,449,201,394,208,169,362,82,475,97,192,303,253,183,222,281,476,376,304,326,128,202,295,375,446,110,248,119,195,139,213,39,371,249,429,425,310,158,45,157,33,191,415,289,329,263,27,162,215,365,36,151,412,211,322,298,58,383,448,423,100,455,305,179,407,457,290,422,88,232,52,267,436,113,141,271,353,418,266,95,292,327,410,284,107,308,227,261,91,115,447,302,473,401,402,239,71,197,426,459,86,24,260,343,182,405,99,142,388,35,330,216,108,121,240,250,452,381,134,234,38,466,112,472,130,352,203,120,380,285,396,470,404,275,245,316,481,458,206,431,137,55,467,282,51,280,409,176,81,73,406,299,244,430,274,255,117,435,85,350,367,109,279,317,391,460,66,323,28,416,131,241,180,50,148,46,165,174,124,106,360,389,265,160,204,321,220,463,190,276,163,166,319,196,72,454,156,347];
const PAL=['#1B1B1B','#2E5BFF','#2DB35A','#00B8D9','#B5179E','#D7263D','#F5C518','#F77F00'];
const TXT=['#fff','#fff','#04101f','#04101f','#fff','#fff','#04101f','#04101f'];
const CY='#2fe6ff',GOLD='#ffd24a',RED='#ff2d3f',G=7,LZ=[2*G,G,0,-G,-2*G],HX=[0,1,2,3,4,5].map(k=>[Math.cos(Math.PI/6+k*Math.PI/3),Math.sin(Math.PI/6+k*Math.PI/3)]);
const NAMES=['Data','Error correction','Header','Guide cells + border','Orientation pattern'],COUNT=[227,96,72,100,9];
const clamp=(x,a=0,b=1)=>x<a?a:x>b?b:x,E=x=>x*x*x*(x*(6*x-15)+10),bin=v=>v.toString(2).padStart(3,'0');
const hash=(i,k)=>Math.floor((((Math.sin(i*12.9898+k*78.233)*43758.5453)%1)+1)%1*8);
/* ---- the real code: 21 x 24 cells, roles from the encoder layout ---- */
const cells=[];
for(let j=0;j<R;j++)for(let i=0;i<C;i++){
const k=j*C+i,n=+NUM[k];
cells.push({i,j,L:+ROLE[k],n,wx:S3*(i+.5+.5*(j&1))-S3*(C+.5)/2,wy:1+1.5*j-(2+1.5*(R-1))/2,w:(i/(C-1)+j/(R-1))/2,
col:n==8?'#ffffff':PAL[n],tc:n==8?'#04101f':TXT[n],k:-1});
}
ORDER.forEach((idx,k)=>cells[idx].k=k);
const D=ORDER.slice(0,227).map(i=>cells[i]),EC=ORDER.slice(227).map(i=>cells[i]);
/* illustrative damage: four data cells near the middle, each fed by its nearest error-correction cell */
const mid=D.slice().sort((a,b)=>Math.hypot(a.wx,a.wy*1.3)-Math.hypot(b.wx,b.wy*1.3)).slice(0,60);
const dm=[],used=new Set();
const two=mid.find(c=>c.n==2);dm.push(two);
for(const c of mid){if(dm.length>=4)break;if(c!==two&&Math.hypot(c.wx-two.wx,c.wy-two.wy)>7&&dm.every(d=>Math.hypot(c.wx-d.wx,c.wy-d.wy)>7))dm.push(c)}
const DM=dm.map((c,i)=>{let best=null,bd=1e9;for(const e of EC){if(used.has(e))continue;const d=Math.hypot(e.wx-c.wx,e.wy-c.wy);if(d<bd){bd=d;best=e}}used.add(best);
return {c,e:best,wrong:i==0?5:(c.n+3+i)%8,tb:14.8+i*.58}});
D.forEach(c=>c.di=-1);DM.forEach((d,i)=>d.c.di=i);
const T_DATA=9.8,T_EC=13.3,T_DMG=14.1,T_BACK=17.7;
const CAP=[[0,'Real Comb Code','21 × 24 hexagon cells, each one of 8 colors.'],
[3.4,'Splitting it open','The cells lift apart into five layers. Every cell keeps its exact place.'],
[5.3,'1. Data · 227 cells','These carry your message, scattered across the whole code.'],
[6.2,'2. Error correction · 96 cells','Extra numbers that fix damaged cells. They are mixed in with the data, not in a separate block.'],
[7.1,'3. Header · 72 cells','Black and white cells that say how to read the code. The note is written three times.'],
[8.0,'4. Guide cells + border · 100 cells','Colours the reader already knows. They fix lighting, tint and bent paper.'],
[8.9,'5. Orientation pattern · 9 cells','The top-left corner shows which way is up. No message inside.'],
[T_DATA,'Data layer','Every cell is a number from 0 to 7. They carry the message, a check number and filler.'],
[11.4,'Data layer','The reader gets the same numbers as 0s and 1s: three bits per cell.'],
[T_EC,'Error correction','These 96 cells hold 36 extra bytes. They can repair up to 18 wrong bytes.'],
[T_DMG,'Damage found','Four cells got smudged. Their numbers are now wrong.'],
[14.8,'Rebuilding','The extra numbers work out each right value.'],
[17.1,'All 4 repaired','The message is safe again. (Illustration.)'],
[T_BACK,'Back together','One code, five layers.'],[19.6,'Real Comb Code','']];
/* ---- layout ---- */
let W,H,dpr,S,SE,cx,cy,capH,mob,bg;
function resize(){
dpr=Math.min(devicePixelRatio||1,2);W=cv.clientWidth||360;mob=W<560;
H=Math.round(mob?W*1.5:Math.min(W*.72,700));cv.style.height=H+'px';cv.width=W*dpr;cv.height=H*dpr;ctx.setTransform(dpr,0,0,dpr,0,0);
capH=mob?150:124;S=Math.min((W-28)/44,(H-capH-60)/50);cx=W/2;cy=46+(H-46-capH)/2;
bg=document.createElement('canvas');bg.width=W*dpr;bg.height=H*dpr;
const b=bg.getContext('2d');b.setTransform(dpr,0,0,dpr,0,0);
const g=b.createRadialGradient(cx,cy,10,cx,cy,Math.max(W,H)*.8);g.addColorStop(0,'#0b2c5e');g.addColorStop(.55,'#071d42');g.addColorStop(1,'#030d22');
b.fillStyle=g;b.fillRect(0,0,W,H);
const u=mob?14:16;
b.lineWidth=1;b.strokeStyle='rgba(150,205,255,.06)';b.beginPath();
for(let x=cx%u;x<W;x+=u){b.moveTo(x,0);b.lineTo(x,H)}for(let y=cy%u;y<H;y+=u){b.moveTo(0,y);b.lineTo(W,y)}b.stroke();
b.strokeStyle='rgba(170,220,255,.16)';b.beginPath();
for(let x=cx%(u*5);x<W;x+=u*5){b.moveTo(x,0);b.lineTo(x,H)}for(let y=cy%(u*5);y<H;y+=u*5){b.moveTo(0,y);b.lineTo(W,y)}b.stroke();
/* centre lines and registration marks */
b.strokeStyle='rgba(190,235,255,.28)';b.setLineDash([10,5,2,5]);b.beginPath();b.moveTo(cx,18);b.lineTo(cx,H-18);b.moveTo(14,cy);b.lineTo(W-14,cy);b.stroke();b.setLineDash([]);
b.strokeStyle='rgba(220,245,255,.7)';b.lineWidth=1;
for(const [x,y] of [[cx,12],[cx,H-12],[12,cy],[W-12,cy]]){b.beginPath();b.arc(x,y,5,0,6.283);b.moveTo(x-9,y);b.lineTo(x+9,y);b.moveTo(x,y-9);b.lineTo(x,y+9);b.stroke()}
/* title block */
if(!mob){const bw=190,bh=42,bx=W-bw-22,by=H-bh-14;b.strokeStyle='rgba(220,245,255,.55)';b.strokeRect(bx,by,bw,bh);b.beginPath();b.moveTo(bx,by+bh/2);b.lineTo(bx+bw,by+bh/2);b.moveTo(bx+bw*.55,by);b.lineTo(bx+bw*.55,by+bh);b.stroke();
b.fillStyle='rgba(220,245,255,.8)';b.font='9px '+MONO;b.fillText('COMB CODE',bx+6,by+14);b.fillText('21 x 24 CELLS',bx+6,by+bh-7);b.fillText('SHEET 1/1',bx+bw*.55+6,by+14);b.fillText('NOT TO SCALE',bx+bw*.55+6,by+bh-7)}
}
/* ---- perspective camera: yaw + tilt orbit ---- */
let cY,sY,cT,sT;
const cam=(yaw,tilt)=>{cY=Math.cos(yaw);sY=Math.sin(yaw);cT=Math.cos(tilt);sT=Math.sin(tilt)};
function P(x,y,z){const x1=x*cY-y*sY,y1=x*sY+y*cY,yy=y1*cT-z*sT,zd=y1*sT+z*cT,s=90/(90-zd);return [cx+x1*SE*s,cy+yy*SE*s,s]}
function hexPath(c,z){ctx.beginPath();for(let k=0;k<6;k++){const q=P(c.wx+HX[k][0]*1.02,c.wy+HX[k][1]*1.02,z);k?ctx.lineTo(q[0],q[1]):ctx.moveTo(q[0],q[1])}ctx.closePath()}
function wrap(txt,x,y,maxW,lh){let line='';for(const w of txt.split(' ')){const t=line?line+' '+w:w;if(ctx.measureText(t).width>maxW&&line){ctx.fillText(line,x,y);y+=lh;line=w}else line=t}ctx.fillText(line,x,y)}
const gl=[1,1,1,1,1],LEG=[...document.querySelectorAll('#phLegend li')],MOTE=Array.from({length:44},(_,i)=>[(i*.618034)%1,(i*.381966+.17)%1,.3+((i*.7548)%1)*.7]);let lastAct=-2,yawNow=0;
const PX=24,PY=23.4;
function frame(t,dt,st){
const up=t<T_BACK;
const Lx=st?1:up?E(clamp((t-3)/2.4)):1-E(clamp((t-T_BACK)/2));
const dv=st?0:E(clamp((t-9.3)/.8))*(1-E(clamp((t-17.4)/.6)));
const zoom=1+(mob?.8:.25)*dv;SE=S*zoom;
yawNow=Lx*(-.3+.3*Math.sin((t-3)*.45));cam(yawNow,(st?.9:.78*Lx)-.28*dv);
const lift=c=>st?1:up?E(clamp((t-3.2-c.w*.9)/1.1)):1-E(clamp((t-T_BACK-(1-c.w)*.8)/1.1));
const zOf=c=>{const p=lift(c);return LZ[c.L]*p+Math.sin(Math.PI*p)*1.4+rip(c)*2.8};
const pl=st?1:up?E(clamp((t-3.4)/1.4)):1-E(clamp((t-T_BACK)/1.3));
const cardA=st?0:up?1-E(clamp((t-3)/.7)):E(clamp((t-19)/.6));
const ring=(c,r,col,al)=>{if(r<=0||al<=0)return;const z=zOf(c);ctx.globalAlpha=Math.min(1,al);ctx.strokeStyle=col;ctx.lineWidth=2;ctx.beginPath();for(let k=0;k<=24;k++){const q=P(c.wx+Math.cos(k*.2618)*r,c.wy+Math.sin(k*.2618)*r,z);k?ctx.lineTo(q[0],q[1]):ctx.moveTo(q[0],q[1])}ctx.stroke();ctx.globalAlpha=1};
let act=-1;
if(!st){if(t>=5.3&&t<T_DATA)act=Math.min(4,Math.floor((t-5.3)/.9));else if(t>=T_DATA&&t<T_EC)act=0;else if(t>=T_EC&&t<T_BACK)act=1}
if(act!==lastAct){lastAct=act;LEG.forEach((e,i)=>e.classList.toggle('on',i==act))}
for(let i=0;i<5;i++){const tg=(st||act<0)?1:(i==act?1:(act==1&&i==0?.5:.2));gl[i]=st?1:gl[i]+(tg-gl[i])*(1-Math.exp(-dt*9))}
const nA=st?1:clamp((t-T_DATA)/.35)*(1-clamp((t-17.5)/.4));
const sA=!st&&t>.4&&t<2.9,sB=false,scan=sA,sbX=cx+(-25+50*clamp((t-.4)/2.5))*S,rd=st?504:Math.floor(504*clamp((t-.4)/2.5));
/* one-way scan: beam moves left to right once; cells ripple behind it */
const bwx=-25+50*clamp((t-.4)/2.5),rip=c=>{if(st||t<.4||t>4.4)return 0;const d=bwx-c.wx;if(d<0)return 0;return Math.sin(d*.6)*Math.exp(-d*.1)*clamp((4.4-t)/1.4)};
ctx.globalAlpha=1;ctx.clearRect(0,0,W,H);ctx.drawImage(bg,0,0,W,H);
ctx.fillStyle='#9fefff';for(const m of MOTE){ctx.globalAlpha=.1+.25*m[2];ctx.fillRect(((m[0]*W-yawNow*m[2]*90)%W+W)%W,((m[1]*H-t*6*m[2])%H+H)%H,1+m[2],1+m[2])}ctx.globalAlpha=1;
/* white card */
if(cardA>.01){const q=[[-PX,-PY],[PX,-PY],[PX,PY],[-PX,PY]].map(a=>P(a[0],a[1],0));
ctx.globalAlpha=cardA;ctx.fillStyle='#fff';ctx.beginPath();q.forEach((a,k)=>k?ctx.lineTo(a[0],a[1]):ctx.moveTo(a[0],a[1]));ctx.closePath();ctx.fill();}
if(!st&&t<3.6){const k=1+.35*(1-E(clamp(t/.7))),aL=clamp(1-(t-3)/.5),w=PX*k,h=PY*k;ctx.globalAlpha=aL;ctx.strokeStyle=CY;ctx.lineWidth=2.5;ctx.beginPath();
for(const [sx,sy] of [[-1,-1],[1,-1],[1,1],[-1,1]]){const q=P(sx*w,sy*h,0);ctx.moveTo(q[0]-sx*S*5,q[1]);ctx.lineTo(q[0],q[1]);ctx.lineTo(q[0],q[1]-sy*S*5)}ctx.stroke();
if(t>2.3){const o=P(cells[22].wx,cells[22].wy,0);ctx.globalAlpha=aL*.9;ctx.lineWidth=2;ctx.strokeStyle='#fff';ctx.beginPath();ctx.arc(o[0],o[1],S*3.2*(1+.25*Math.sin(t*14)),0,6.283);ctx.stroke()}ctx.globalAlpha=1}
if(pl>.01){ctx.globalAlpha=.3*pl;ctx.strokeStyle=CY;ctx.lineWidth=1;ctx.setLineDash([4,5]);ctx.beginPath();
for(const [sx,sy] of [[-1,-1],[1,-1],[1,1],[-1,1]]){const a=P(sx*PX,sy*PY,LZ[0]*pl),b=P(sx*PX,sy*PY,LZ[4]*pl);ctx.moveTo(a[0],a[1]);ctx.lineTo(b[0],b[1])}ctx.stroke();ctx.setLineDash([]);ctx.globalAlpha=1}
const order=[];for(const i of [4,3,2,1,0])if(i!=act)order.push(i);if(act>=0)order.push(act);
for(const i of order){
const gold=i==1&&act==1;
if(pl>.01){ /* glass sheet */
const q=[[-PX,-PY],[PX,-PY],[PX,PY],[-PX,PY]].map(a=>P(a[0],a[1],LZ[i]*pl));
ctx.globalAlpha=pl*(.4+.6*gl[i]);ctx.fillStyle=gold?'rgba(255,210,74,.07)':'rgba(47,230,255,.045)';
ctx.beginPath();q.forEach((a,k)=>k?ctx.lineTo(a[0],a[1]):ctx.moveTo(a[0],a[1]));ctx.closePath();ctx.fill();
ctx.strokeStyle=gold?GOLD:CY;ctx.lineWidth=1;ctx.stroke();ctx.lineWidth=2;ctx.beginPath();
for(let k=0;k<4;k++){const a=q[k],b=q[(k+1)%4],d=q[(k+3)%4];
ctx.moveTo(a[0]+(d[0]-a[0])*.1,a[1]+(d[1]-a[1])*.1);ctx.lineTo(a[0],a[1]);ctx.lineTo(a[0]+(b[0]-a[0])*.1,a[1]+(b[1]-a[1])*.1)}
ctx.stroke();
ctx.globalAlpha=pl*(.4+.6*gl[i]);ctx.fillStyle=gold?GOLD:CY;ctx.font=(mob?10:11)+'px '+MONO;ctx.textAlign='left';
ctx.fillText((i+1)+' '+NAMES[i]+' · '+COUNT[i],q[0][0]+3,q[0][1]-6);
}
for(const c of cells){
if(c.L!=i)continue;
const z=zOf(c),p=lift(c);
let a=gl[i]*(1-.06*i);if(a<.01)continue;
let fill=c.col,tc=c.tc,v=c.n,dmg=0,flash=0,ring=0;
if(i==0&&!st&&t>=T_DATA){const rt=10.2+c.k*.0072;if(t<rt){v=hash(c.k,Math.floor(RM.matches?t*2:t*14));fill=PAL[v];tc=TXT[v]}else if(t-rt<.14)ring=1}
if(c.di>=0&&!st&&t>=T_DMG){const d=DM[c.di],tf=d.tb+.5;if(t<tf){v=d.wrong;fill=(RM.matches||Math.sin(t*38+c.di)>0)?RED:'#7a0f1c';tc='#fff';dmg=1}else if(t<tf+.4){v=hash(c.k,Math.floor(t*30));tc=GOLD;flash=1-(t-tf)/.4}else if(t<tf+.9)flash=1-(t-tf-.4)/.5}
const o=P(c.wx,c.wy,z);hexPath(c,z);
ctx.globalAlpha=a;ctx.fillStyle=fill;ctx.fill();{const rr=rip(c);if(rr>.05){ctx.globalAlpha=Math.min(.55,rr*.55);ctx.fillStyle='#fff';ctx.fill();ctx.globalAlpha=a}}
if(!st&&t>.4&&t<3.1){let b=0,tn=0;if(t<2.1||t>=2.1){b=clamp(1-Math.abs(o[0]-sbX)/(S*2.6));tn=o[0]<sbX?.14:0}if(sB){b=Math.max(b,clamp(1-Math.abs(o[1]-sbY)/(S*2.6)));if(o[1]<sbY)tn=.14}const k2=Math.max(b*.6,tn);if(k2>0){ctx.globalAlpha=a*k2;ctx.fillStyle='#8ff3ff';ctx.fill();ctx.globalAlpha=a}}
ctx.lineWidth=1.1;ctx.strokeStyle=fill;ctx.stroke();
if(pl>.02){ctx.globalAlpha=a*pl*.6;ctx.lineWidth=1;ctx.strokeStyle=gold?GOLD:'rgba(190,240,255,.9)';ctx.stroke()}
if(act==i&&gl[i]>.9){ctx.globalAlpha=.3+(gold?.25*Math.sin(t*6-c.w*12):0);ctx.lineWidth=4;ctx.strokeStyle=gold?GOLD:CY;ctx.stroke()}
if(flash||ring||dmg){ctx.globalAlpha=1;ctx.lineWidth=2.5;ctx.strokeStyle=ring?'#fff':dmg?RED:GOLD;if(!dmg)ctx.globalAlpha=ring?1:flash;ctx.stroke()}
if(dmg){ctx.globalAlpha=1;ctx.strokeStyle=RED;ctx.lineWidth=2;const r=SE*o[2]*1.9;ctx.beginPath();for(const [sx,sy] of [[-1,-1],[1,-1],[1,1],[-1,1]]){ctx.moveTo(o[0]+sx*r,o[1]+sy*(r-6));ctx.lineTo(o[0]+sx*r,o[1]+sy*r);ctx.lineTo(o[0]+sx*(r-6),o[1]+sy*r)}ctx.stroke()}
const nn=i==0?nA:(i==1&&act==1&&!st)?clamp((t-T_EC-.3)/.4):0;if(nn>.02&&c.n<8){const fs=Math.max(9,SE*o[2]*1.05);ctx.globalAlpha=a*nn;ctx.fillStyle=tc;ctx.font='bold '+fs+'px '+MONO;ctx.textAlign='center';ctx.fillText(v,o[0],o[1]+fs*.36)}
}
}
ctx.globalAlpha=1;
/* repair: rings, then curved gold beams with travelling sparks */
if(!st&&t>=T_DMG&&t<T_BACK)DM.forEach((d,i)=>{const a0=t-T_DMG-i*.12,a1=t-d.tb-.5,a2=t-d.tb;ring(d.c,a0*9,RED,1-a0*1.3);ring(d.c,a1*11,GOLD,1-a1*1.6);ring(d.e,a2*8,GOLD,.9-a2*2)});
if(!st&&t>=T_DMG&&t<T_BACK)DM.forEach(d=>{
const a=P(d.e.wx,d.e.wy,zOf(d.e)),b=P(d.c.wx,d.c.wy,zOf(d.c)),dist=Math.hypot(b[0]-a[0],b[1]-a[1]),kx=(a[0]+b[0])/2,ky=Math.min(a[1],b[1])-dist*.35-S*3;
const bz=u=>[(1-u)*(1-u)*a[0]+2*u*(1-u)*kx+u*u*b[0],(1-u)*(1-u)*a[1]+2*u*(1-u)*ky+u*u*b[1]];
const pr=clamp((t-d.tb)/.5),fade=1-clamp((t-d.tb-.5)/.4);ctx.lineCap='round';
if(t<d.tb){ctx.globalAlpha=.4;ctx.setLineDash([3,6]);ctx.strokeStyle=GOLD;ctx.lineWidth=1;ctx.beginPath();ctx.moveTo(a[0],a[1]);ctx.quadraticCurveTo(kx,ky,b[0],b[1]);ctx.stroke();ctx.setLineDash([])}
if(pr>0&&fade>0){const q=E(pr),u0=Math.max(0,q-.45);ctx.globalAlpha=fade;
for(let s=0;s<14;s++){const p1=bz(u0+(q-u0)*s/14),p2=bz(u0+(q-u0)*(s+1)/14),f=(s+1)/14;
ctx.strokeStyle='rgba(255,210,74,'+.14*f+')';ctx.lineWidth=10*f;ctx.beginPath();ctx.moveTo(p1[0],p1[1]);ctx.lineTo(p2[0],p2[1]);ctx.stroke();
ctx.strokeStyle='rgba(255,236,160,'+f+')';ctx.lineWidth=2.4*f;ctx.stroke()}
const h=bz(q);ctx.fillStyle='#fff';ctx.beginPath();ctx.arc(h[0],h[1],4,0,6.283);ctx.fill()}
ctx.globalAlpha=1});
/* scan lines */
if(sA||sB){const h=PY*S,w=PX*S;ctx.strokeStyle='#e8fdff';ctx.lineWidth=2;
if(sA){const gr=ctx.createLinearGradient(sbX-110,0,sbX,0);gr.addColorStop(0,'rgba(47,230,255,0)');gr.addColorStop(1,'rgba(47,230,255,.42)');ctx.fillStyle=gr;ctx.fillRect(sbX-110,cy-h,110,2*h);
ctx.beginPath();ctx.moveTo(sbX,cy-h-10);ctx.lineTo(sbX,cy+h+10);ctx.stroke();ctx.fillStyle='#fff';ctx.fillRect(sbX-3,cy-h-14,6,6);ctx.fillRect(sbX-3,cy+h+8,6,6)}
if(sB){const gr=ctx.createLinearGradient(0,sbY-110,0,sbY);gr.addColorStop(0,'rgba(47,230,255,0)');gr.addColorStop(1,'rgba(47,230,255,.42)');ctx.fillStyle=gr;ctx.fillRect(cx-w,sbY-110,2*w,110);
ctx.beginPath();ctx.moveTo(cx-w-10,sbY);ctx.lineTo(cx+w+10,sbY);ctx.stroke();ctx.fillStyle='#fff';ctx.fillRect(cx-w-14,sbY-3,6,6);ctx.fillRect(cx+w+8,sbY-3,6,6)}}
/* blueprint linework: dimension lines and numbered callouts */
if(pl>.05){const al=pl*.85,fs=mob?9:10;ctx.save();ctx.lineWidth=1;ctx.strokeStyle='rgba(225,247,255,.85)';ctx.fillStyle='rgba(225,247,255,.9)';ctx.font=fs+'px '+MONO;ctx.textAlign='center';
const dim=(a,b,off,label)=>{const dx=b[0]-a[0],dy=b[1]-a[1],L=Math.hypot(dx,dy)||1,nx=-dy/L*off,ny=dx/L*off,A=[a[0]+nx,a[1]+ny],B=[b[0]+nx,b[1]+ny];
ctx.globalAlpha=al*.8;ctx.beginPath();ctx.moveTo(a[0]+nx*.25,a[1]+ny*.25);ctx.lineTo(A[0]+nx*.2,A[1]+ny*.2);ctx.moveTo(b[0]+nx*.25,b[1]+ny*.25);ctx.lineTo(B[0]+nx*.2,B[1]+ny*.2);
ctx.moveTo(A[0],A[1]);ctx.lineTo(B[0],B[1]);
for(const [p,sg] of [[A,1],[B,-1]]){const ux=dx/L*sg,uy=dy/L*sg;ctx.moveTo(p[0],p[1]);ctx.lineTo(p[0]+ux*7+uy*3,p[1]+uy*7-ux*3);ctx.moveTo(p[0],p[1]);ctx.lineTo(p[0]+ux*7-uy*3,p[1]+uy*7+ux*3)}
ctx.stroke();const mx=(A[0]+B[0])/2,my=(A[1]+B[1])/2,tw=ctx.measureText(label).width+8;ctx.globalAlpha=al;ctx.save();ctx.translate(mx,my);ctx.fillStyle='#071d42';ctx.fillRect(-tw/2,-7,tw,13);ctx.fillStyle='rgba(225,247,255,.95)';ctx.fillText(label,0,3);ctx.restore()};
const zb=LZ[4]*pl,zt=LZ[0]*pl;
if(!mob)dim(P(-PX,PY,zb),P(PX,PY,zb),-20,'21 cells');
dim(P(-PX,-PY,zt),P(-PX,PY,zt),mob?16:22,'24 rows');
dim(P(PX,PY,zt),P(PX,PY,zb),mob?-10:-14,'5 layers');
/* numbered callouts from each sheet's right edge */
for(let i=0;i<5;i++){const z=LZ[i]*pl,a=P(PX,0,z),bx=Math.min(W-16,a[0]+(mob?20:34)),by=a[1],on=(act==i);
ctx.globalAlpha=al*(on||act<0||st?1:.5);ctx.strokeStyle=on?(i==1?GOLD:CY):'rgba(225,247,255,.7)';ctx.beginPath();ctx.moveTo(a[0],a[1]);ctx.lineTo(bx-9,by);ctx.stroke();
ctx.beginPath();ctx.arc(bx,by,8,0,6.283);ctx.fillStyle=on?(i==1?GOLD:CY):'rgba(7,29,66,.95)';ctx.fill();ctx.stroke();ctx.fillStyle=on?'#03121f':'#e6f8ff';ctx.font='bold '+fs+'px '+MONO;ctx.fillText(String(i+1),bx,by+3.5)}
ctx.restore();ctx.globalAlpha=1}
/* HUD */
ctx.strokeStyle=CY;ctx.lineWidth=2;ctx.globalAlpha=.9;ctx.beginPath();
for(const [x,y,sx,sy] of [[8,8,1,1],[W-8,8,-1,1],[8,H-8,1,-1],[W-8,H-8,-1,-1]]){ctx.moveTo(x+sx*18,y);ctx.lineTo(x,y);ctx.lineTo(x,y+sy*18)}
ctx.stroke();ctx.globalAlpha=.85;ctx.fillStyle=CY;ctx.font='11px '+MONO;ctx.textAlign='left';ctx.fillText('COMB CODE // layer scan',18,28);
for(let i=0;i<5;i++){ctx.globalAlpha=(i==act||st)?1:.3;ctx.fillRect(W-18-(5-i)*14,22,10,4)}
ctx.globalAlpha=1;
if(!st&&t>.4&&t<3.4){ctx.font='bold 12px '+MONO;ctx.fillStyle=CY;ctx.fillText(t<2.3?'reading cells '+rd+' / 504':'code found · orientation corner locked',18,48)}
if(!st&&t>=T_DMG&&t<T_BACK){ctx.font='bold 12px '+MONO;ctx.fillStyle=RED;ctx.fillText('damage found: 4 cells',18,48);
if(t>=14.8){let n=0;DM.forEach(d=>{if(t>=d.tb+.5)n++});ctx.fillStyle=GOLD;ctx.fillText('fixed '+n+' of 4',18,66)}}
/* caption */
let ci=0;if(!st)for(let i=0;i<CAP.length;i++)if(t>=CAP[i][0])ci=i;
const cap=st?['Five layers','Data, error correction, header, guide cells + border, orientation pattern.']:[CAP[ci][1],CAP[ci][2]];
const ca=st?1:clamp((t-CAP[ci][0])/.25),y0=H-capH+16+(1-ca)*6;
ctx.globalAlpha=ca;ctx.textAlign='left';ctx.fillStyle=ci>=9&&ci<=12&&!st?GOLD:CY;ctx.font='bold 13px '+SANS;ctx.fillText(cap[0],18,y0);
ctx.fillStyle='#d6ecff';ctx.font=(mob?15:17)+'px '+SANS;wrap(cap[1],18,y0+24,W-36,mob?21:24);ctx.globalAlpha=1;
/* binary ticker: the same numbers, in the order the reader gets them */
const ta=st?1:clamp((t-10.2)/.3)*(1-clamp((t-13.4)/.3));
if(ta>.02){const n=st?227:clamp(Math.floor((t-10.2)/.0072)+1,0,227);
if(n>0){const yb=H-18,s=D.slice(Math.max(0,n-30),n-1).map(c=>bin(c.n)).join(' ')+' ',L=bin(D[n-1].n);
ctx.save();ctx.beginPath();ctx.rect(74,yb-16,W-92,24);ctx.clip();ctx.globalAlpha=ta;ctx.font='13px '+MONO;ctx.textAlign='right';
ctx.fillStyle='#fff';ctx.fillText(L,W-18,yb);ctx.fillStyle='rgba(47,230,255,.85)';ctx.fillText(s,W-18-ctx.measureText(L).width,yb);ctx.restore();
ctx.globalAlpha=ta;ctx.fillStyle=GOLD;ctx.font='11px '+MONO;ctx.textAlign='left';ctx.fillText('binary',18,yb);ctx.globalAlpha=1}}
}
/* ---- run loop: starts in view, pauses off-screen, never touches scroll ---- */
let t=0,last=0,raf=0,vis=false,began=false;
function tick(now){raf=requestAnimationFrame(tick);const dt=Math.min(.05,(now-last)/1000);last=now;t=(t+dt)%LOOP;frame(t,dt,false)}
function go(){if(vis&&!document.hidden){if(!raf){last=performance.now();raf=requestAnimationFrame(tick)}}else{cancelAnimationFrame(raf);raf=0}}
function still(){if(!raf)frame(t,0,false)}
new IntersectionObserver(es=>{vis=es[es.length-1].isIntersecting;if(vis&&!began){began=true;t=0}go()},{threshold:.2}).observe(cv);
document.addEventListener('visibilitychange',go);
RM.addEventListener&&RM.addEventListener('change',()=>{go();still()});
new ResizeObserver(()=>{resize();still()}).observe(cv);
resize();still();
if(document.fonts&&document.fonts.load){document.fonts.load('600 13px Poppins').then(()=>{still()})}
})();
</script>
<section class="b tint center rv"><div class="in"><h2 class="k">Point your camera.<br>That's the whole app.</h2><p class="lede">No account, no upload, no signal needed. Open the scanner, keep the white edge in view, and the message appears under the code.</p><div class="cta-row"><a class="btn btn-pri" href="scan.html">Open the scanner</a><a class="btn btn-sec" href="use.html">Scan from a photo</a></div></div></section>
<section class="b center rv" id="how"><div class="in"><h2 class="k">Type it. Print it. Scan it.</h2><p class="lede">Comb is like a QR code, but made of colored hexagons.</p>
<div class="steps"><div class="step"><i>01</i><h3>Make</h3><p>Type a message or paste a link on the Use page. Save the picture.</p></div><div class="step"><i>02</i><h3>Share</h3><p>Print it or show it on a screen. Keep the white edge around it.</p></div><div class="step"><i>03</i><h3>Scan</h3><p>Point the camera. The message shows only when its checksum is right, otherwise it says try again.</p></div></div>
<p class="fine">Curious how it works inside? Read the <a href="docs.html">docs</a>.</p></div></section>
<section class="b tint center rv" id="room"><div class="in"><h2 class="k">More room, in color.</h2><p class="lede">Colored cells carry more data than black and white ones. That is the one place Comb holds more.</p>
<div class="stats"><div class="stat"><b>4,071</b><span>bytes in one color Comb code, largest size, 20% error correction</span></div><div class="stat"><b>2,953</b><span>bytes in the largest standard QR, lowest error correction</span></div><div class="stat"><b>0</b><span>wrong results in our desktop tests. A scan shows a message only when its checksum matches.</span></div></div>
</div></section>
<section class="b dark" id="secure"><div class="in split"><div><h2 class="k">Lock it.<br>Sign it.</h2><p class="lede">Comb Code Secure can lock a code with a password (AES-256-GCM) and optionally sign it (ECDSA P-256). It all happens on your device.</p><a class="more" href="comb-secure.html">Try Comb Code Secure</a></div><div><div id="secureLogoHome" style="width:100%;max-width:520px;margin:0 auto;aspect-ratio:1060/600;display:flex;align-items:center;justify-content:center"><img src="brand/comb-secure-lock-locked-on-dark.svg" alt="Comb Code Secure lock" width="260" height="260" style="width:min(200px,55%);height:auto"></div></div></div></section><script src="secure-logo.js?v=2026-11-25-4"></script><script>if(window.PrismSecureLogo&&!matchMedia("(max-width:900px),(pointer:coarse)").matches)PrismSecureLogo.mount(document.getElementById("secureLogoHome"),document.getElementById("secure"));</script>
<section class="b center rv"><div class="in"><h2 class="k">What we plan next.</h2><div class="plan"><div><h3>Verified issuers</h3><p>A public list of trusted signing keys, so a scan can show a name you can check.</p><p><a href="docs.html#issuers"><b>How it works</b></a> · <a href="use.html?demo=issuer"><b>Demo</b></a></p></div><div><h3>Big files in parts</h3><p>Split a larger file across several codes and scan them in turn.</p><p><a href="docs.html#parts"><b>How it works</b></a> · <a href="use.html?demo=parts"><b>Demo</b></a></p></div><div><h3>Tickets and cards</h3><p>Expiring codes, business cards and Wi-Fi sharing, on the Make a code page.</p><p><a href="docs.html#cards"><b>How it works</b></a> · <a href="boarding.html"><b>Demo</b></a></p></div></div></div></div></section>
<section class="b tint center rv"><div class="in"><h2 class="k">Try it in ten seconds.</h2><div class="cta-row"><a class="btn btn-pri" href="scan.html">Scan a code</a><a class="btn btn-sec" href="use.html">Make a code</a><a class="btn btn-sec" href="install.html">Install the app</a></div></div></section>
<div class="sitefoot"><div id="buildStamp" style="font:500 12px/1.4 Poppins,system-ui,sans-serif;opacity:.7;margin-bottom:6px">Build 101</div><div class="pcredit-in" style="margin-bottom:8px">Comb Code by <a href="https://getcombcode.github.io/">Avi Shor</a> · <a href="license.html">License</a> · <a href="mailto:combcode.app@gmail.com">combcode.app@gmail.com</a></div><a href="index.html">Home</a> <a href="scan.html">Scan</a> <a href="use.html">Use</a> <a href="comb.html">Advanced</a> <a href="docs.html">Docs</a> <a href="install.html">Install</a> <a href="https://github.com/getcombcode/getcombcode.github.io">GitHub</a></div><script>document.documentElement.classList.add('js');(function(){var els=[].slice.call(document.querySelectorAll('.rv')),rm=matchMedia('(prefers-reduced-motion: reduce)').matches;if(rm||!('IntersectionObserver' in window)){els.forEach(function(e){e.classList.add('on')});return}var io=new IntersectionObserver(function(en){en.forEach(function(x){if(x.isIntersecting){x.target.classList.add('on');io.unobserve(x.target)}})},{threshold:.1});els.forEach(function(e){io.observe(e)})})();try{if(window.caches)caches.keys().then(function(k){var m=k.filter(function(n){return n.indexOf('prism-shell-')===0}).map(function(n){return n.slice(12)}).sort().pop();var e=document.getElementById('buildStamp');if(e&&m)e.textContent='Build 79 \u00b7 app '+m}).catch(function(){})}catch(_){}if('serviceWorker'in navigator&&(location.protocol==='https:'||location.hostname==='localhost'))navigator.serviceWorker.register('comb-sw.js').catch(function(){});</script><script src="comb-creator.js"></script><script src="motion.js"></script></body></html>