-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
915 lines (812 loc) · 44.6 KB
/
Copy pathindex.html
File metadata and controls
915 lines (812 loc) · 44.6 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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>King Pizza Corner — Order Online</title>
<style>
:root{
--bg:#FFF8EE;
--paper:#FFFFFF;
--ink:#241C15;
--ink-soft:#7a6c5d;
--red:#C7311F;
--red-dark:#9c2517;
--cheese:#F0A400;
--basil:#2E6F40;
--basil-dark:#1f4d2c;
--maroon:#8a2a1f;
--line:#ECE1CF;
--shadow:0 10px 30px -12px rgba(36,28,21,.22);
--font-display: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif;
--font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
h1,h2,h3,p{ margin:0; }
button{ font:inherit; border:none; background:none; color:inherit; cursor:pointer; }
html,body{ margin:0; padding:0; }
body{
background:#EDE7DA;
font-family:var(--font-body);
color:var(--ink);
-webkit-font-smoothing:antialiased;
}
:focus-visible{ outline:2px solid var(--red); outline-offset:2px; }
.app-shell{
max-width:560px;
margin:0 auto;
min-height:100vh;
background:var(--bg);
position:relative;
box-shadow:0 0 60px rgba(0,0,0,.10);
padding-bottom:96px;
overflow-x:hidden;
}
/* Marquee */
.marquee{ background:var(--red); color:#FFF6E8; overflow:hidden; height:34px; display:flex; align-items:center; }
.marquee__track{ display:flex; white-space:nowrap; animation:marquee 16s linear infinite; }
.marquee__track span{ padding:0 22px; font-size:12.5px; font-weight:700; letter-spacing:.01em; }
@keyframes marquee{ from{ transform:translateX(0); } to{ transform:translateX(-50%); } }
/* Header */
.app-header{ position:sticky; top:0; z-index:40; background:var(--bg); border-bottom:1px solid var(--line); }
.brand-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px 10px; }
.brand{ display:flex; align-items:center; gap:10px; }
.brand h1{ font-family:var(--font-display); font-size:19px; line-height:1.15; color:var(--ink); }
.brand p{ margin-top:2px; font-size:11.5px; color:var(--ink-soft); }
.veg-toggle-wrap{ display:flex; align-items:center; gap:8px; flex-shrink:0; }
.veg-toggle-wrap span{ font-size:12px; font-weight:700; }
.switch{ position:relative; width:42px; height:24px; flex-shrink:0; display:inline-block; }
.switch input{ opacity:0; position:absolute; inset:0; width:100%; height:100%; margin:0; cursor:pointer; z-index:2; }
.switch .track{ position:absolute; inset:0; background:#D8CFBF; border-radius:999px; transition:background .2s; }
.switch .thumb{ position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); transition:transform .2s; }
.switch input:checked ~ .track{ background:var(--basil); }
.switch input:checked ~ .thumb{ transform:translateX(18px); }
.switch input:focus-visible ~ .track{ outline:2px solid var(--red); outline-offset:2px; }
.cat-nav{ display:flex; gap:8px; overflow-x:auto; padding:10px 16px 12px; scrollbar-width:none; -ms-overflow-style:none; }
.cat-nav::-webkit-scrollbar{ display:none; }
.cat-pill{ flex:0 0 auto; padding:8px 16px; border-radius:999px; border:1px solid var(--line); background:var(--paper); font-size:13px; font-weight:700; white-space:nowrap; transition:background .15s,color .15s,border-color .15s; }
.cat-pill.active{ background:var(--red); border-color:var(--red); color:#FFF6E8; }
main{ padding-top:4px; }
/* Featured ticket */
.ticket{ margin:16px; background:var(--paper); border-radius:18px; overflow:hidden; box-shadow:var(--shadow); position:relative; animation:rise .5s ease both; }
.ticket__photo{ position:relative; height:168px; background:linear-gradient(135deg,var(--red),var(--cheese)); display:flex; align-items:center; justify-content:center; font-size:60px; }
.ticket__stamp{ position:absolute; top:12px; right:12px; background:rgba(255,246,232,.94); border:2px solid var(--red); color:var(--red); font-size:11px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; padding:5px 10px; border-radius:6px; transform:rotate(7deg); }
.ticket__divider{ position:relative; height:0; border-top:2px dashed #E3D6C2; }
.ticket__divider::before,.ticket__divider::after{ content:""; position:absolute; top:-9px; width:18px; height:18px; border-radius:50%; background:var(--bg); }
.ticket__divider::before{ left:-9px; }
.ticket__divider::after{ right:-9px; }
.ticket__body{ padding:18px 20px 20px; }
.ticket__eyebrow{ font-size:11px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; color:var(--ink-soft); }
.ticket__title-row{ display:flex; align-items:center; gap:8px; margin-top:5px; }
.ticket__title-row h2{ font-family:var(--font-display); font-size:23px; }
.ticket__size{ margin-top:3px; }
.ticket__desc{ font-size:14px; color:var(--ink-soft); line-height:1.5; margin:9px 0 14px; }
.addon-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; background:var(--bg); border:1px solid var(--line); border-radius:12px; padding:11px 14px; margin-bottom:16px; cursor:pointer; }
.addon-row__label{ display:flex; align-items:center; gap:8px; font-size:14px; font-weight:700; }
.addon-row__right{ display:flex; align-items:center; gap:10px; }
.addon-row__price{ font-size:12.5px; font-weight:800; color:var(--basil-dark); background:#E4EEE3; padding:4px 9px; border-radius:999px; white-space:nowrap; }
.addon-row input[type="checkbox"]{ width:19px; height:19px; accent-color:var(--basil); cursor:pointer; }
.ticket__price-row{ display:flex; align-items:baseline; gap:8px; margin-bottom:14px; }
.ticket__price{ font-size:27px; font-weight:800; font-variant-numeric:tabular-nums; }
.btn-add-lg{ width:100%; border-radius:14px; background:var(--basil); color:#fff; font-size:16px; font-weight:800; padding:15px; letter-spacing:.01em; transition:transform .1s, background .15s; }
.btn-add-lg:active{ transform:scale(.98); }
.btn-add-lg:hover{ background:var(--basil-dark); }
.ticket__cart-row{ display:flex; align-items:center; justify-content:space-between; }
.ticket__cart-row .label{ font-size:14px; font-weight:700; }
.stepper{ display:flex; align-items:center; gap:14px; border:2px solid var(--basil); border-radius:12px; padding:7px 12px; }
.stepper button{ color:var(--basil-dark); font-size:19px; font-weight:900; line-height:1; width:16px; }
.stepper span{ min-width:14px; text-align:center; font-weight:800; font-size:14px; }
/* Section headings */
.section-heading{ display:flex; align-items:center; gap:10px; padding:22px 16px 10px; }
.section-heading .bar{ width:5px; height:20px; background:var(--red); border-radius:3px; flex-shrink:0; }
.section-heading h2{ font-family:var(--font-display); font-size:20px; }
.menu-section{ scroll-margin-top:116px; }
.cat-note{ margin:0 16px 14px; padding:9px 13px; background:var(--paper); border:1px solid var(--line); border-radius:10px; font-size:11.5px; color:var(--ink-soft); font-weight:600; line-height:1.5; }
.item-group{ display:flex; flex-direction:column; gap:14px; }
.group-label{ display:flex; align-items:center; gap:7px; font-size:11.5px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-soft); padding:4px 0 2px; }
.group-label .dot{ width:9px; height:9px; border-radius:2px; border:1.5px solid var(--basil); position:relative; flex-shrink:0; }
.group-label .dot::after{ content:""; position:absolute; inset:1.5px; border-radius:50%; background:var(--basil); }
.group-label .dot.nonveg{ border-color:var(--maroon); }
.group-label .dot.nonveg::after{ background:var(--maroon); border-radius:0; clip-path:polygon(50% 0,100% 100%,0 100%); inset:1px; }
.topping-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:12px 14px; animation:rise .4s ease both; }
.topping-row__left{ display:flex; align-items:center; gap:9px; min-width:0; }
.topping-row__name{ font-family:var(--font-display); font-size:15px; }
.topping-row__right{ display:flex; align-items:center; gap:12px; flex-shrink:0; }
.topping-row__price{ font-size:13px; font-weight:800; color:var(--ink-soft); }
/* Item cards */
.item-list{ display:flex; flex-direction:column; gap:14px; padding:0 16px 4px; }
.item-card{ display:flex; gap:14px; background:var(--paper); border:1px solid var(--line); border-radius:16px; padding:14px; align-items:flex-start; animation:rise .4s ease both; }
body.veg-only [data-veg="false"]{ display:none; }
.item-info{ flex:1; min-width:0; }
.item-title-row{ display:flex; align-items:center; gap:7px; }
.veg-dot{ width:13px; height:13px; border:1.5px solid var(--basil); border-radius:3px; position:relative; flex-shrink:0; }
.veg-dot::after{ content:""; position:absolute; inset:2.5px; border-radius:50%; background:var(--basil); }
.veg-dot.nonveg{ border-color:var(--maroon); }
.veg-dot.nonveg::after{ background:var(--maroon); border-radius:0; clip-path:polygon(50% 0,100% 100%,0 100%); inset:2px; }
.item-info h3{ font-family:var(--font-display); font-size:16.5px; }
.item-desc{ font-size:12.8px; color:var(--ink-soft); line-height:1.45; margin:5px 0 8px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.item-price{ font-size:15px; font-weight:800; font-variant-numeric:tabular-nums; }
.item-media{ position:relative; flex-shrink:0; width:92px; }
.item-image{ width:92px; height:92px; border-radius:14px; display:flex; align-items:center; justify-content:center; font-size:36px; }
.tile-pizza{ background:linear-gradient(135deg,#FFE8B8,#F0A400); }
.item-media [data-control-for]{ position:absolute; left:50%; bottom:-13px; transform:translateX(-50%); }
.add-btn{ background:#fff; border:1.5px solid var(--basil); color:var(--basil-dark); font-weight:800; font-size:12.5px; padding:7px 16px; border-radius:999px; box-shadow:0 3px 8px rgba(36,28,21,.16); white-space:nowrap; }
.add-btn:active{ transform:scale(.95); }
.item-media .stepper{ background:#fff; box-shadow:0 3px 8px rgba(36,28,21,.16); padding:6px 10px; }
.item-media .stepper button{ width:14px; font-size:16px; }
@keyframes pop{ 0%{ transform:scale(.8); } 55%{ transform:scale(1.12); } 100%{ transform:scale(1); } }
.pop{ animation:pop .32s cubic-bezier(.34,1.56,.64,1); }
/* Bottom cart bar */
.cart-bar{ position:fixed; left:0; right:0; bottom:0; max-width:560px; margin:0 auto; width:100%; background:var(--ink); color:#FFF6E8; display:flex; align-items:center; justify-content:space-between; padding:14px 16px calc(14px + env(safe-area-inset-bottom)); border-radius:18px 18px 0 0; box-shadow:0 -8px 30px rgba(0,0,0,.28); transform:translateY(120%); transition:transform .25s ease; z-index:50; }
.cart-bar.show{ transform:translateY(0); }
.cart-bar__text{ font-size:14px; font-weight:700; text-align:left; }
.cart-bar__btn{ background:var(--cheese); color:var(--ink); border-radius:999px; padding:11px 18px; font-weight:800; font-size:13.5px; display:flex; align-items:center; gap:5px; }
/* Drawer */
.drawer-overlay{ position:fixed; inset:0; background:rgba(20,15,10,.5); opacity:0; pointer-events:none; transition:opacity .25s; z-index:60; display:flex; align-items:flex-end; justify-content:center; }
.drawer-overlay.open{ opacity:1; pointer-events:auto; }
.drawer{ background:var(--bg); width:100%; max-width:560px; max-height:82vh; border-radius:22px 22px 0 0; display:flex; flex-direction:column; transform:translateY(100%); transition:transform .3s ease; }
.drawer-overlay.open .drawer{ transform:translateY(0); }
.drawer__header{ display:flex; align-items:center; justify-content:space-between; padding:16px 18px; border-bottom:1px solid var(--line); flex-shrink:0; }
.drawer__header h2{ font-family:var(--font-display); font-size:19px; }
.drawer__close{ font-size:20px; color:var(--ink-soft); padding:4px; }
.drawer__body{ overflow-y:auto; padding:6px 18px; flex:1; }
.cart-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 0; border-bottom:1px solid var(--line); }
.cart-row__name{ font-weight:700; font-size:14px; }
.cart-row__meta{ font-size:12px; color:var(--ink-soft); margin-top:2px; }
.cart-row__line-total{ font-size:12.5px; font-weight:700; color:var(--ink-soft); margin-top:6px; text-align:right; }
.drawer__summary{ border-top:1px solid var(--line); padding:14px 18px 4px; flex-shrink:0; }
.summary-row{ display:flex; justify-content:space-between; font-size:14px; padding:4px 0; }
.summary-row.total{ font-size:17px; font-weight:800; padding-top:10px; border-top:1px dashed var(--line); margin-top:6px; }
.free-delivery-hint{ font-size:12.5px; color:var(--basil-dark); background:#E4EEE3; padding:9px 10px; border-radius:10px; margin-bottom:8px; text-align:center; font-weight:700; }
.drawer__checkout{ margin:14px 18px calc(18px + env(safe-area-inset-bottom)); flex-shrink:0; }
.empty-cart{ text-align:center; padding:56px 20px; color:var(--ink-soft); }
.empty-cart .emoji{ font-size:44px; display:block; margin-bottom:12px; }
.order-success{ text-align:center; padding:48px 24px 20px; }
.order-success .emoji{ font-size:50px; display:block; margin-bottom:14px; }
.order-success h3{ font-family:var(--font-display); font-size:20px; margin-bottom:6px; }
.order-success p{ color:var(--ink-soft); font-size:14px; line-height:1.5; }
.drawer__header-left{ display:flex; align-items:center; gap:2px; }
.drawer__back{ font-size:22px; line-height:1; color:var(--ink-soft); padding:4px 8px 4px 2px; }
.checkout-summary{ background:var(--bg); border:1px solid var(--line); border-radius:12px; padding:10px 14px 4px; margin:2px 0 18px; }
.form-field{ margin-bottom:15px; }
.form-label{ display:block; font-size:12.5px; font-weight:700; margin-bottom:6px; }
.form-input, .form-textarea{ width:100%; border:1.5px solid var(--line); border-radius:12px; padding:12px 13px; font-size:15px; font-family:inherit; color:var(--ink); background:#fff; }
.form-input:focus, .form-textarea:focus{ outline:none; border-color:var(--basil); }
.form-input.error, .form-textarea.error{ border-color:var(--red); }
.form-textarea{ resize:none; min-height:66px; line-height:1.45; }
.form-error{ display:none; font-size:11.5px; color:var(--red); margin-top:5px; font-weight:600; }
.form-error.show{ display:block; }
.form-hint{ font-size:11px; color:var(--ink-soft); margin-top:5px; }
.form-alert{ background:#FBEAE7; color:var(--red-dark); border:1px solid #F0C4BC; border-radius:12px; padding:11px 13px; font-size:12.5px; font-weight:700; margin:2px 0 16px; line-height:1.4; }
.pay-options{ display:flex; flex-direction:column; gap:10px; }
.pay-option{ display:flex; align-items:flex-start; gap:10px; border:1.5px solid var(--line); border-radius:12px; padding:12px 13px; cursor:pointer; }
.pay-option:has(input:checked){ border-color:var(--basil); background:#F1F7EF; }
.pay-option input[type="radio"]{ width:18px; height:18px; margin-top:1px; accent-color:var(--basil); flex-shrink:0; cursor:pointer; }
.pay-option__title{ font-size:14px; font-weight:700; }
.pay-option__sub{ font-size:11.5px; color:var(--ink-soft); margin-top:2px; }
@keyframes rise{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:translateY(0); } }
@media (prefers-reduced-motion: reduce){
.marquee__track{ animation:none; }
.marquee{ overflow-x:auto; }
.ticket, .item-card{ animation:none; }
.pop{ animation:none; }
*{ transition-duration:.001ms !important; }
}
</style>
</head>
<body>
<div class="app-shell">
<div class="marquee" role="note" aria-label="Promotion">
<div class="marquee__track" aria-hidden="true">
<span>🍕 Get FREE delivery on orders above ₹300! · Hot & fresh from our oven 🔥</span>
<span>🍕 Get FREE delivery on orders above ₹300! · Hot & fresh from our oven 🔥</span>
</div>
</div>
<header class="app-header">
<div class="brand-row">
<div class="brand">
<svg width="38" height="38" viewBox="0 0 40 40" aria-hidden="true">
<circle cx="20" cy="20" r="20" fill="#C7311F"/>
<path d="M20 9 L30.5 29 L9.5 29 Z" fill="#F0A400"/>
<circle cx="17.5" cy="21" r="1.7" fill="#2E6F40"/>
<circle cx="23" cy="24" r="1.7" fill="#2E6F40"/>
<circle cx="18.5" cy="26" r="1.7" fill="#2E6F40"/>
</svg>
<div>
<h1>King Pizza Corner</h1>
<p>High quality pizzas, straight to your door</p>
</div>
</div>
<div class="veg-toggle-wrap">
<span>Veg Only</span>
<label class="switch">
<input type="checkbox" id="vegToggle" aria-label="Show vegetarian items only" />
<span class="track"></span>
<span class="thumb"></span>
</label>
</div>
</div>
<nav class="cat-nav" aria-label="Menu categories">
<button class="cat-pill" data-target="cat-magic">Magic Bite</button>
<button class="cat-pill" data-target="cat-loaded">Loaded Pizza</button>
<button class="cat-pill" data-target="cat-addons">Add-Ons</button>
</nav>
</header>
<main>
<!-- Featured bestseller -->
<section class="ticket" data-veg="true" aria-label="Featured bestseller">
<div class="ticket__photo">
<span aria-hidden="true">🍄🫒</span>
<span class="ticket__stamp">★ Bestseller</span>
</div>
<div class="ticket__divider"></div>
<div class="ticket__body">
<div class="ticket__eyebrow">Today's Pick</div>
<div class="ticket__title-row">
<span class="veg-dot" aria-hidden="true"></span>
<h2>Olive Mushroom Paprika Loaded Paneer Pizza</h2>
</div>
<div class="ticket__eyebrow ticket__size">10 inches · 8 slices</div>
<p class="ticket__desc">Paneer, mushroom, black olive and smoky paprika on a cheese-loaded 10-inch base.</p>
<label class="addon-row" for="cheeseAddon">
<span class="addon-row__label">🧀 Add Extra Cheese</span>
<span class="addon-row__right">
<span class="addon-row__price">+₹39</span>
<input type="checkbox" id="cheeseAddon" />
</span>
</label>
<div class="ticket__price-row">
<span class="ticket__price" id="featuredPrice">₹199</span>
</div>
<div id="featuredControl"></div>
</div>
</section>
<section class="menu-section" id="cat-magic">
<div class="section-heading"><span class="bar"></span><h2>Magic Bite</h2></div>
<div class="cat-note">6 inches · 4 slices | Add-on cheese ₹29 | Cheese burst ₹80</div>
<div class="item-list" id="list-magic"></div>
</section>
<section class="menu-section" id="cat-loaded">
<div class="section-heading"><span class="bar"></span><h2>Loaded Pizza</h2></div>
<div class="cat-note">10 inches · 8 slices | Add-on cheese ₹39</div>
<div class="item-list" id="list-loaded"></div>
</section>
<section class="menu-section" id="cat-addons">
<div class="section-heading"><span class="bar"></span><h2>Add-Ons</h2></div>
<div class="cat-note">Extra toppings — add these on to any pizza in your cart.</div>
<div class="item-list" id="list-addons"></div>
</section>
</main>
<button class="cart-bar" id="cartBar" aria-label="View cart">
<span class="cart-bar__text" id="cartBarText">Cart: 0 items · ₹0</span>
<span class="cart-bar__btn">View Cart ›</span>
</button>
<div class="drawer-overlay" id="drawerOverlay">
<div class="drawer" role="dialog" aria-modal="true" aria-label="Your cart">
<div class="drawer__header">
<div class="drawer__header-left">
<button class="drawer__back" id="drawerBack" aria-label="Back to cart" style="display:none;">‹</button>
<h2 id="drawerTitle">Your Order</h2>
</div>
<button class="drawer__close" id="drawerClose" aria-label="Close cart">✕</button>
</div>
<div class="drawer__body" id="drawerBody"></div>
<div id="drawerFooter"></div>
</div>
</div>
</div>
<script>
// ---------- Real menu data ----------
const MENU_SECTIONS = [
{
key: 'magic', target: 'list-magic',
groups: [
{ label: 'Veg', veg: true, items: [
{ id:'mb-corn', veg:true, emoji:'🌽', name:'Corn Loaded Magic', desc:'Sweet corn piled high on our 6-inch mini base.', price:69 },
{ id:'mb-onion', veg:true, emoji:'🧅', name:'Onion Loaded Magic', desc:'Crisp onion loaded over melted mozzarella, fresh & simple.', price:69 },
{ id:'mb-paneer', veg:true, emoji:'🧀', name:'Paneer Loaded Magic', desc:'Soft paneer cubes over a cheesy 6-inch mini base.', price:99 },
]},
{ label: 'Non-Veg', veg: false, items: [
{ id:'mb-chicken', veg:false, emoji:'🍗', name:'Chicken Magic', desc:'Seasoned chicken chunks on our signature mini-size base.', price:99 },
{ id:'mb-western', veg:false, emoji:'🌶️', name:'Western Magic', desc:'Pepperoni chicken pizza, western-style, on a spicy mini base.', price:119 },
]},
],
},
{
key: 'loaded', target: 'list-loaded',
groups: [
{ label: 'Veg', veg: true, items: [
{ id:'lp-margherita', veg:true, emoji:'🍅', name:'Classic Margherita Pizza', desc:'Tomato, mozzarella & herbs — the original classic.', price:119 },
{ id:'lp-double-margherita', veg:true, emoji:'🧀', name:'Double Cheese Loaded Margherita Pizza', desc:'Classic margherita piled with a double layer of cheese.', price:169 },
{ id:'lp-corn', veg:true, emoji:'🌽', name:'Classic Corn Loaded Pizza', desc:'Sweet corn, generously loaded over melted mozzarella.', price:159 },
{ id:'lp-paprika-mushroom', veg:true, emoji:'🍄', name:'Paprika Onion Mushroom Pizza', desc:'Smoky paprika, onion & mushroom on a cheesy base.', price:179 },
{ id:'lp-corn-capsicum', veg:true, emoji:'🫑', name:'Corn Loaded Onion and Capsicum Pizza', desc:'Corn, onion & capsicum, piled high and cheesy.', price:179 },
{ id:'lp-jalapeno-olive', veg:true, emoji:'🌶️', name:'Cheese Loaded Onion Jalapeño Black Olive and Paprika Pizza', desc:'Onion, jalapeño, black olive & paprika, extra cheesy.', price:189 },
{ id:'lp-veg-loaded', veg:true, emoji:'🥦', name:'Classic Vegetable Loaded Pizza', desc:'Loaded with all our fresh vegetables, edge to edge.', price:199 },
{ id:'lp-mushroom', veg:true, emoji:'🍄', name:'Classic Mushroom Loaded Pizza', desc:'Mushroom, generously loaded over melted mozzarella.', price:169 },
{ id:'lp-corn-olive-paprika',veg:true, emoji:'🫒', name:'Corn Olive and Paprika Pizza', desc:'Corn, black olive & smoky paprika on a cheesy base.', price:179 },
{ id:'lp-tomato-olive-corn', veg:true, emoji:'🍅', name:'Tomato Olive and Corn Loaded Veggies Pizza',desc:'Tomato, olive & corn — a fresh veggie combo.', price:169 },
]},
{ label: 'Paneer', veg: true, items: [
{ id:'lp-paneer-tikka', veg:true, emoji:'🧀', name:'Paneer Tikka Masala Pizza', desc:'Tandoori paneer tikka in a rich masala sauce.', price:199 },
{ id:'lp-bbq-paneer', veg:true, emoji:'🔥', name:'Barbecue Paneer and Paprika Pizza', desc:'Smoky barbecue paneer with paprika, on a cheesy base.', price:199 },
{ id:'lp-paneer-lababdar', veg:true, emoji:'🧀', name:'Paneer Lababdar with Corn Pizza', desc:'Rich paneer lababdar with sweet corn, generously loaded.', price:209 },
{ id:'lp-malai-paneer', veg:true, emoji:'🧀', name:'Corn Loaded Malai Paneer Pizza', desc:'Creamy malai paneer with sweet corn, extra cheesy.', price:189 },
{ id:'lp-double-paneer', veg:true, emoji:'🧀', name:'Double Cheese Loaded Paneer Pizza with Onion & Jalapeño', desc:'Paneer, onion & jalapeño under a double layer of cheese.', price:199 },
// Note: 'Olive Mushroom Paprika Loaded Paneer Pizza' (₹199) is featured as today's bestseller above, so it's not repeated in this list.
]},
],
},
{
key: 'addons', target: 'list-addons', compact: true,
groups: [
{ label: null, veg: null, items: [
{ id:'ao-corn', veg:true, name:'Corn', price:20 },
{ id:'ao-capsicum', veg:true, name:'Capsicum', price:20 },
{ id:'ao-paprika', veg:true, name:'Paprika', price:30 },
{ id:'ao-jalapeno', veg:true, name:'Jalapeño', price:30 },
{ id:'ao-onion', veg:true, name:'Onion', price:10 },
{ id:'ao-tomato', veg:true, name:'Tomato', price:20 },
{ id:'ao-olive', veg:true, name:'Olive', price:30 },
{ id:'ao-paneer', veg:true, name:'Paneer', price:40 },
{ id:'ao-chicken', veg:false, name:'Chicken', price:40 },
]},
],
},
];
const FEATURED_BASE = 199;
const CHEESE_ADDON = 39;
const FREE_DELIVERY_MIN = 300;
const DELIVERY_FEE = 20;
let cart = {}; // id -> { name, price, qty }
let drawerStep = 'cart'; // 'cart' | 'checkout' | 'success'
let checkoutData = { name: '', phone: '', address: '', payment: 'cod' };
let checkoutTouched = { name: false, phone: false, address: false };
let checkoutError = '';
let placingOrder = false;
let lastOrder = null;
function money(n){ return '₹' + Number(n).toLocaleString('en-IN'); }
function esc(s){ return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); }
// ---------- Menu rendering ----------
function renderMenu(){
MENU_SECTIONS.forEach(section => {
const container = document.getElementById(section.target);
container.innerHTML = section.groups.map(group => {
const labelHtml = group.label
? `<div class="group-label"><span class="dot ${group.veg ? '' : 'nonveg'}" aria-hidden="true"></span>${group.label}</div>`
: '';
const itemsHtml = group.items
.map(item => section.compact ? toppingRowHTML(item) : itemCardHTML(item))
.join('');
const groupVegAttr = group.label ? ` data-veg="${group.veg}"` : '';
return `<div class="item-group"${groupVegAttr}>${labelHtml}${itemsHtml}</div>`;
}).join('');
});
MENU_SECTIONS.forEach(section => {
section.groups.forEach(group => {
group.items.forEach(item => renderItemControl(item.id, item.price, item.name));
});
});
}
function itemCardHTML(item){
return `
<div class="item-card" data-veg="${item.veg}">
<div class="item-info">
<div class="item-title-row">
<span class="veg-dot ${item.veg ? '' : 'nonveg'}" aria-hidden="true"></span>
<h3>${item.name}</h3>
</div>
<p class="item-desc">${item.desc}</p>
<div class="item-price">${money(item.price)}</div>
</div>
<div class="item-media">
<div class="item-image tile-pizza">${item.emoji}</div>
<div data-control-for="${item.id}"></div>
</div>
</div>`;
}
function toppingRowHTML(item){
return `
<div class="topping-row" data-veg="${item.veg}">
<div class="topping-row__left">
<span class="veg-dot ${item.veg ? '' : 'nonveg'}" aria-hidden="true"></span>
<span class="topping-row__name">${item.name}</span>
</div>
<div class="topping-row__right">
<span class="topping-row__price">${money(item.price)}</span>
<div data-control-for="${item.id}"></div>
</div>
</div>`;
}
function renderItemControl(id, price, name){
const el = document.querySelector(`[data-control-for="${id}"]`);
if (!el) return;
const qty = cart[id] ? cart[id].qty : 0;
if (qty === 0){
el.innerHTML = `<button class="add-btn pop" data-action="add" data-id="${id}" data-name="${esc(name)}" data-price="${price}">+ ADD</button>`;
} else {
el.innerHTML = `
<div class="stepper pop">
<button data-action="dec" data-id="${id}" aria-label="Remove one ${esc(name)}">−</button>
<span>${qty}</span>
<button data-action="inc" data-id="${id}" aria-label="Add one more ${esc(name)}">+</button>
</div>`;
}
}
// ---------- Featured item ----------
const cheeseCheckbox = document.getElementById('cheeseAddon');
const featuredPriceEl = document.getElementById('featuredPrice');
const featuredControlEl = document.getElementById('featuredControl');
function currentFeaturedId(){ return cheeseCheckbox.checked ? 'featured-cheese' : 'featured-plain'; }
function currentFeaturedPrice(){ return FEATURED_BASE + (cheeseCheckbox.checked ? CHEESE_ADDON : 0); }
function currentFeaturedName(){ return 'Olive Mushroom Paprika Loaded Paneer Pizza' + (cheeseCheckbox.checked ? ' + Extra Cheese' : ''); }
function updateFeaturedUI(){
featuredPriceEl.textContent = money(currentFeaturedPrice());
updateFeaturedControl();
}
function updateFeaturedControl(){
const id = currentFeaturedId();
const price = currentFeaturedPrice();
const qty = cart[id] ? cart[id].qty : 0;
if (qty === 0){
featuredControlEl.innerHTML = `<button class="btn-add-lg pop" data-action="add" data-id="${id}" data-name="${esc(currentFeaturedName())}" data-price="${price}">+ ADD · ${money(price)}</button>`;
} else {
featuredControlEl.innerHTML = `
<div class="ticket__cart-row">
<span class="label">In your cart</span>
<div class="stepper pop">
<button data-action="dec" data-id="${id}" aria-label="Remove one">−</button>
<span>${qty}</span>
<button data-action="inc" data-id="${id}" aria-label="Add one more">+</button>
</div>
</div>`;
}
}
cheeseCheckbox.addEventListener('change', updateFeaturedUI);
// ---------- Cart logic (event delegation) ----------
function haptic(ms){
if (navigator.vibrate){
try { navigator.vibrate(ms); } catch (e) { /* unsupported / blocked, ignore */ }
}
}
document.addEventListener('click', (e) => {
const btn = e.target.closest('[data-action]');
if (!btn) return;
const action = btn.dataset.action;
const id = btn.dataset.id;
if (action === 'add'){
const name = btn.dataset.name;
const price = Number(btn.dataset.price);
cart[id] = { name, price, qty: 1 };
} else if (action === 'inc'){
if (cart[id]) cart[id].qty++;
} else if (action === 'dec'){
if (cart[id]){
cart[id].qty--;
if (cart[id].qty <= 0) delete cart[id];
}
} else {
return;
}
haptic(action === 'add' ? 18 : 10);
afterCartChange(id);
});
function findMenuItem(id){
for (const section of MENU_SECTIONS){
for (const group of section.groups){
const found = group.items.find(i => i.id === id);
if (found) return found;
}
}
return null;
}
function afterCartChange(id){
if (id === 'featured-plain' || id === 'featured-cheese'){
updateFeaturedControl();
} else {
const item = findMenuItem(id);
if (item) renderItemControl(item.id, item.price, item.name);
}
updateCartBar();
if (drawerOverlay.classList.contains('open') && drawerStep === 'cart') renderDrawer();
}
function cartCount(){ return Object.values(cart).reduce((s, i) => s + i.qty, 0); }
function cartSubtotal(){ return Object.values(cart).reduce((s, i) => s + i.qty * i.price, 0); }
const cartBar = document.getElementById('cartBar');
const cartBarText = document.getElementById('cartBarText');
function updateCartBar(){
const count = cartCount();
const subtotal = cartSubtotal();
cartBarText.textContent = `Cart: ${count} item${count === 1 ? '' : 's'} · ${money(subtotal)}`;
cartBar.classList.toggle('show', count > 0);
}
cartBar.addEventListener('click', openDrawer);
// ---------- Drawer ----------
const drawerOverlay = document.getElementById('drawerOverlay');
const drawerBody = document.getElementById('drawerBody');
const drawerFooter = document.getElementById('drawerFooter');
const drawerTitle = document.getElementById('drawerTitle');
const drawerBack = document.getElementById('drawerBack');
document.getElementById('drawerClose').addEventListener('click', closeDrawer);
drawerOverlay.addEventListener('click', (e) => { if (e.target === drawerOverlay) closeDrawer(); });
document.addEventListener('keydown', (e) => { if (e.key === 'Escape') closeDrawer(); });
function openDrawer(){ drawerStep = 'cart'; renderDrawer(); drawerOverlay.classList.add('open'); }
function closeDrawer(){ drawerOverlay.classList.remove('open'); }
function setDrawerHeader(title, showBack){
drawerTitle.textContent = title;
drawerBack.style.display = showBack ? 'inline-flex' : 'none';
}
function renderDrawer(){
renderCartStep();
}
function renderCartStep(){
setDrawerHeader('Your Order', false);
const entries = Object.entries(cart);
if (entries.length === 0){
drawerBody.innerHTML = `
<div class="empty-cart">
<span class="emoji">🍕</span>
<p>Your cart's empty.<br>Add something delicious to get started.</p>
</div>`;
drawerFooter.innerHTML = '';
return;
}
drawerBody.innerHTML = entries.map(([id, item]) => `
<div class="cart-row">
<div>
<div class="cart-row__name">${item.name}</div>
<div class="cart-row__meta">${money(item.price)} each</div>
</div>
<div>
<div class="stepper">
<button data-action="dec" data-id="${id}" aria-label="Remove one ${esc(item.name)}">−</button>
<span>${item.qty}</span>
<button data-action="inc" data-id="${id}" aria-label="Add one more ${esc(item.name)}">+</button>
</div>
<div class="cart-row__line-total">${money(item.price * item.qty)}</div>
</div>
</div>`).join('');
const subtotal = cartSubtotal();
const deliveryFee = subtotal >= FREE_DELIVERY_MIN ? 0 : DELIVERY_FEE;
const total = subtotal + deliveryFee;
let hint = '';
if (subtotal > 0 && subtotal < FREE_DELIVERY_MIN){
hint = `<div class="free-delivery-hint">Add ${money(FREE_DELIVERY_MIN - subtotal)} more for FREE delivery 🎉</div>`;
}
drawerFooter.innerHTML = `
<div class="drawer__summary">
${hint}
<div class="summary-row"><span>Item Total</span><span>${money(subtotal)}</span></div>
<div class="summary-row"><span>Delivery Fee</span><span>${deliveryFee === 0 ? 'FREE' : money(deliveryFee)}</span></div>
<div class="summary-row total"><span>Grand Total</span><span>${money(total)}</span></div>
</div>
<div class="drawer__checkout">
<button class="btn-add-lg" id="checkoutStepBtn">Proceed to Checkout · ${money(total)}</button>
</div>`;
document.getElementById('checkoutStepBtn').addEventListener('click', goToCheckout);
}
// ---------- Checkout step ----------
function goToCheckout(){
drawerStep = 'checkout';
checkoutError = '';
renderCheckoutStep();
drawerBody.scrollTop = 0;
}
function normalizePhone(v){
let d = String(v || '').replace(/\D/g, '');
if (d.length === 12 && d.startsWith('91')) d = d.slice(2);
if (d.length === 11 && d.startsWith('0')) d = d.slice(1);
return d;
}
function isValidName(v){ return String(v || '').trim().length >= 2; }
function isValidPhone(v){ return /^[6-9]\d{9}$/.test(normalizePhone(v)); }
function isValidAddress(v){ return String(v || '').trim().length >= 10; }
function fieldValid(f){
if (f === 'name') return isValidName(checkoutData.name);
if (f === 'phone') return isValidPhone(checkoutData.phone);
if (f === 'address') return isValidAddress(checkoutData.address);
return true;
}
const fieldErrorMsg = {
name: 'Please enter your name.',
phone: 'Enter a valid 10-digit mobile number.',
address: 'Add your complete address with a landmark.',
};
function showFieldError(f, forceShow){
const input = document.querySelector(`[data-field="${f}"]`);
const errorEl = document.getElementById(`err-${f}`);
const touched = forceShow || checkoutTouched[f];
const show = touched && !fieldValid(f);
if (input) input.classList.toggle('error', show);
if (errorEl){
errorEl.textContent = fieldErrorMsg[f] || '';
errorEl.classList.toggle('show', show);
}
}
function renderCheckoutStep(){
setDrawerHeader('Checkout', true);
const subtotal = cartSubtotal();
const deliveryFee = subtotal >= FREE_DELIVERY_MIN ? 0 : DELIVERY_FEE;
const grandTotal = subtotal + deliveryFee;
drawerBody.innerHTML = `
${checkoutError ? `<div class="form-alert">${esc(checkoutError)}</div>` : ''}
<div class="checkout-summary">
<div class="summary-row"><span>Item Total</span><span>${money(subtotal)}</span></div>
<div class="summary-row"><span>Delivery Fee</span><span>${deliveryFee === 0 ? 'FREE' : money(deliveryFee)}</span></div>
<div class="summary-row total"><span>Grand Total</span><span>${money(grandTotal)}</span></div>
</div>
<div class="form-field">
<label class="form-label" for="coName">Full Name</label>
<input class="form-input" id="coName" data-field="name" type="text" placeholder="e.g. Aditi Sharma" value="${esc(checkoutData.name)}" autocomplete="name" />
<div class="form-error" id="err-name"></div>
</div>
<div class="form-field">
<label class="form-label" for="coPhone">WhatsApp Phone Number</label>
<input class="form-input" id="coPhone" data-field="phone" type="tel" inputmode="numeric" placeholder="10-digit mobile number" value="${esc(checkoutData.phone)}" autocomplete="tel" />
<div class="form-error" id="err-phone"></div>
<div class="form-hint">We'll send order updates on WhatsApp.</div>
</div>
<div class="form-field">
<label class="form-label" for="coAddress">Complete Delivery Address / Landmark</label>
<textarea class="form-textarea" id="coAddress" data-field="address" placeholder="House/flat no., street, area, nearby landmark" autocomplete="street-address">${esc(checkoutData.address)}</textarea>
<div class="form-error" id="err-address"></div>
</div>
<div class="form-field">
<label class="form-label">Payment Method</label>
<div class="pay-options">
<label class="pay-option" id="payOptCod">
<input type="radio" name="payment" value="cod" data-field="payment" ${checkoutData.payment === 'cod' ? 'checked' : ''} />
<div>
<div class="pay-option__title">Pay on Delivery</div>
<div class="pay-option__sub">Cash or UPI QR at the door</div>
</div>
</label>
<label class="pay-option" id="payOptUpi">
<input type="radio" name="payment" value="upi" data-field="payment" ${checkoutData.payment === 'upi' ? 'checked' : ''} />
<div>
<div class="pay-option__title">Pay Now via UPI</div>
<div class="pay-option__sub">You'll get a payment link on the next step</div>
</div>
</label>
</div>
</div>`;
drawerFooter.innerHTML = `
<div class="drawer__checkout">
<button class="btn-add-lg" id="placeOrderBtn">Place Order · ${money(grandTotal)}</button>
</div>`;
document.getElementById('placeOrderBtn').addEventListener('click', attemptPlaceOrder);
['name', 'phone', 'address'].forEach(f => showFieldError(f, false));
}
document.addEventListener('input', (e) => {
const f = e.target.dataset.field;
if (!f || drawerStep !== 'checkout') return;
if (f === 'payment') { checkoutData.payment = e.target.value; return; }
checkoutData[f] = e.target.value;
showFieldError(f, false);
});
document.addEventListener('focusout', (e) => {
const f = e.target.dataset.field;
if (!f || f === 'payment' || drawerStep !== 'checkout') return;
checkoutTouched[f] = true;
showFieldError(f, true);
});
drawerBack.addEventListener('click', () => {
drawerStep = 'cart';
renderCartStep();
});
function attemptPlaceOrder(){
checkoutTouched = { name: true, phone: true, address: true };
['name', 'phone', 'address'].forEach(f => showFieldError(f, true));
const firstInvalid = ['name', 'phone', 'address'].find(f => !fieldValid(f));
if (firstInvalid){
const el = document.querySelector(`[data-field="${firstInvalid}"]`);
if (el) el.focus();
return;
}
placeOrderFinal();
}
async function sendOrderToKitchen(order){
const res = await fetch('/api/send-order', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(order),
});
let data = {};
try { data = await res.json(); } catch (e) { /* non-JSON error response */ }
if (!res.ok || !data.success){
throw new Error(data.error || 'Request failed');
}
return data;
}
async function placeOrderFinal(){
if (placingOrder) return;
const subtotal = cartSubtotal();
const deliveryFee = subtotal >= FREE_DELIVERY_MIN ? 0 : DELIVERY_FEE;
const order = {
orderId: 'KPC' + Math.floor(1000 + Math.random() * 9000),
name: checkoutData.name.trim(),
phone: normalizePhone(checkoutData.phone),
address: checkoutData.address.trim(),
payment: checkoutData.payment,
items: Object.entries(cart).map(([id, item]) => ({ id, name: item.name, price: item.price, qty: item.qty })),
itemTotal: subtotal,
deliveryFee,
grandTotal: subtotal + deliveryFee,
};
placingOrder = true;
checkoutError = '';
const btn = document.getElementById('placeOrderBtn');
if (btn){ btn.disabled = true; btn.textContent = 'Placing order…'; }
try {
await sendOrderToKitchen(order);
lastOrder = order;
drawerStep = 'success';
renderSuccessStep();
} catch (err){
console.error('Order notification failed:', err);
checkoutError = "Couldn't reach the kitchen. Please check your connection and try again.";
renderCheckoutStep();
} finally {
placingOrder = false;
}
}
function renderSuccessStep(){
setDrawerHeader('Order Placed', false);
drawerBody.innerHTML = `
<div class="order-success">
<span class="emoji">🎉</span>
<h3>Order placed!</h3>
<p>Order ID <strong>${lastOrder.orderId}</strong><br>Estimated delivery: 30–35 mins.</p>
</div>
<div class="checkout-summary">
<div class="summary-row"><span>Name</span><span>${esc(lastOrder.name)}</span></div>
<div class="summary-row"><span>WhatsApp</span><span>${esc(lastOrder.phone)}</span></div>
<div class="summary-row"><span>Payment</span><span>${lastOrder.payment === 'cod' ? 'Pay on Delivery' : 'Pay via UPI'}</span></div>
<div class="summary-row total"><span>Grand Total</span><span>${money(lastOrder.grandTotal)}</span></div>
</div>
<div class="form-hint" style="margin:-8px 0 16px;">Delivering to: ${esc(lastOrder.address)}</div>`;
drawerFooter.innerHTML = `
<div class="drawer__checkout">
<button class="btn-add-lg" id="continueBtn" style="background:var(--ink);">Continue Browsing</button>
</div>`;
document.getElementById('continueBtn').addEventListener('click', () => {
cart = {};
checkoutData = { name: '', phone: '', address: '', payment: 'cod' };
checkoutTouched = { name: false, phone: false, address: false };
drawerStep = 'cart';
updateCartBar();
renderMenu();
updateFeaturedUI();
closeDrawer();
});
}
// ---------- Veg Only toggle ----------
document.getElementById('vegToggle').addEventListener('change', (e) => {
document.body.classList.toggle('veg-only', e.target.checked);
});
// ---------- Category nav + scrollspy ----------
const pills = document.querySelectorAll('.cat-pill');
pills.forEach(p => {
p.addEventListener('click', () => {
const target = document.getElementById(p.dataset.target);
if (target) target.scrollIntoView({ behavior: 'smooth', block: 'start' });
});
});
const sections = document.querySelectorAll('.menu-section');
if ('IntersectionObserver' in window){
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting){
pills.forEach(p => p.classList.toggle('active', p.dataset.target === entry.target.id));
}
});
}, { rootMargin: '-40% 0px -50% 0px', threshold: 0 });
sections.forEach(s => observer.observe(s));
}
// ---------- Init ----------
renderMenu();
updateFeaturedUI();
updateCartBar();
</script>
</body>
</html>