example.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. <!doctype html>
  2. <html lang="en" data-mode="light">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <title>Filebase · Tweaks demo</title>
  7. <link rel="preconnect" href="https://fonts.googleapis.com">
  8. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  9. <link href="https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
  10. <style>
  11. :root {
  12. --accent: #c96442;
  13. --scale: 1;
  14. --density: 1;
  15. --motion-mult: 1;
  16. --bg: #f6f4ef;
  17. --paper: #ffffff;
  18. --ink: #1a1a1c;
  19. --muted: #6b6964;
  20. --rule: #e2dfd7;
  21. --serif: 'Source Serif 4', Georgia, serif;
  22. --sans: 'Inter', -apple-system, system-ui, sans-serif;
  23. --mono: 'IBM Plex Mono', ui-monospace, monospace;
  24. }
  25. [data-mode="dark"] {
  26. --bg: #0e0d0c;
  27. --paper: #181715;
  28. --ink: #f4f1ea;
  29. --muted: #8a857a;
  30. --rule: #2a2723;
  31. }
  32. @media (prefers-reduced-motion: reduce) {
  33. :root { --motion-mult: 0; }
  34. }
  35. * { box-sizing: border-box; }
  36. html, body { margin: 0; padding: 0; min-height: 100%; }
  37. body {
  38. background: var(--bg);
  39. color: var(--ink);
  40. font-family: var(--sans);
  41. font-size: calc(16px * var(--scale));
  42. line-height: 1.55;
  43. transition: background calc(220ms * var(--motion-mult)) ease,
  44. color calc(220ms * var(--motion-mult)) ease;
  45. }
  46. /* ============ Layout ============ */
  47. .wrap {
  48. max-width: 1200px;
  49. margin: 0 auto;
  50. padding: calc(28px * var(--density)) calc(40px * var(--density));
  51. }
  52. /* ============ Header / nav ============ */
  53. .nav {
  54. display: flex;
  55. justify-content: space-between;
  56. align-items: center;
  57. padding: calc(20px * var(--density)) 0;
  58. gap: calc(32px * var(--density));
  59. border-bottom: 1px solid var(--rule);
  60. }
  61. .brand {
  62. display: flex;
  63. align-items: center;
  64. gap: 10px;
  65. font-family: var(--serif);
  66. font-weight: 700;
  67. font-size: calc(20px * var(--scale));
  68. letter-spacing: -0.01em;
  69. }
  70. .brand-mark {
  71. width: 28px; height: 28px;
  72. border-radius: 6px;
  73. background: var(--accent);
  74. transition: background calc(220ms * var(--motion-mult)) ease;
  75. }
  76. .nav-links {
  77. display: flex;
  78. gap: calc(28px * var(--density));
  79. font-size: calc(14px * var(--scale));
  80. color: var(--muted);
  81. }
  82. .nav-links a {
  83. color: inherit;
  84. text-decoration: none;
  85. transition: color calc(180ms * var(--motion-mult)) ease;
  86. }
  87. .nav-links a:hover { color: var(--ink); }
  88. .cta {
  89. display: inline-block;
  90. padding: calc(10px * var(--density)) calc(18px * var(--density));
  91. background: var(--accent);
  92. color: #fff;
  93. border-radius: 6px;
  94. font-size: calc(13px * var(--scale));
  95. font-weight: 600;
  96. letter-spacing: 0.02em;
  97. text-decoration: none;
  98. transition: background calc(220ms * var(--motion-mult)) ease,
  99. transform calc(220ms * var(--motion-mult)) ease;
  100. }
  101. .cta:hover { transform: translateY(-1px); }
  102. /* ============ Hero ============ */
  103. .hero {
  104. padding: calc(96px * var(--density)) 0 calc(80px * var(--density));
  105. display: grid;
  106. grid-template-columns: 1.4fr 1fr;
  107. gap: calc(64px * var(--density));
  108. align-items: center;
  109. }
  110. @media (max-width: 880px) {
  111. .hero { grid-template-columns: 1fr; }
  112. }
  113. .eyebrow {
  114. font-family: var(--mono);
  115. font-size: calc(11px * var(--scale));
  116. letter-spacing: 0.22em;
  117. text-transform: uppercase;
  118. color: var(--accent);
  119. margin-bottom: calc(22px * var(--density));
  120. transition: color calc(220ms * var(--motion-mult)) ease;
  121. }
  122. .h1 {
  123. font-family: var(--serif);
  124. font-weight: 700;
  125. font-size: calc(58px * var(--scale));
  126. line-height: 1.04;
  127. letter-spacing: -0.02em;
  128. margin: 0 0 calc(22px * var(--density));
  129. }
  130. .h1 em {
  131. font-style: italic;
  132. color: var(--accent);
  133. font-weight: 600;
  134. transition: color calc(220ms * var(--motion-mult)) ease;
  135. }
  136. .lede {
  137. font-size: calc(19px * var(--scale));
  138. color: var(--muted);
  139. max-width: 38ch;
  140. margin: 0 0 calc(36px * var(--density));
  141. line-height: 1.5;
  142. }
  143. .row { display: flex; gap: calc(14px * var(--density)); align-items: center; flex-wrap: wrap; }
  144. .secondary {
  145. font-size: calc(13px * var(--scale));
  146. color: var(--muted);
  147. font-family: var(--mono);
  148. letter-spacing: 0.18em;
  149. text-transform: uppercase;
  150. }
  151. /* Hero card preview */
  152. .hero-card {
  153. background: var(--paper);
  154. border: 1px solid var(--rule);
  155. border-radius: 10px;
  156. padding: calc(20px * var(--density));
  157. box-shadow: 0 12px 40px rgba(0,0,0,0.06);
  158. font-family: var(--mono);
  159. font-size: calc(12px * var(--scale));
  160. transition: background calc(220ms * var(--motion-mult)) ease,
  161. border-color calc(220ms * var(--motion-mult)) ease;
  162. }
  163. [data-mode="dark"] .hero-card { box-shadow: 0 12px 40px rgba(0,0,0,0.4); }
  164. .hero-card .label {
  165. color: var(--muted);
  166. letter-spacing: 0.2em;
  167. text-transform: uppercase;
  168. margin-bottom: calc(12px * var(--density));
  169. font-size: calc(10px * var(--scale));
  170. }
  171. .hero-card pre {
  172. margin: 0;
  173. padding: calc(14px * var(--density));
  174. background: var(--bg);
  175. border-radius: 6px;
  176. color: var(--ink);
  177. font-family: var(--mono);
  178. font-size: calc(12px * var(--scale));
  179. line-height: 1.55;
  180. overflow-x: auto;
  181. }
  182. .hero-card .k { color: var(--accent); }
  183. .hero-card .c { color: var(--muted); }
  184. .hero-card .ok { color: #4a7a3f; }
  185. [data-mode="dark"] .hero-card .ok { color: #8db876; }
  186. /* ============ Stats strip ============ */
  187. .stats {
  188. display: grid;
  189. grid-template-columns: repeat(4, 1fr);
  190. gap: calc(32px * var(--density));
  191. padding: calc(48px * var(--density)) 0;
  192. border-top: 1px solid var(--rule);
  193. border-bottom: 1px solid var(--rule);
  194. }
  195. @media (max-width: 720px) {
  196. .stats { grid-template-columns: repeat(2, 1fr); }
  197. }
  198. .stat {
  199. display: flex;
  200. flex-direction: column;
  201. gap: calc(6px * var(--density));
  202. }
  203. .stat .num {
  204. font-family: var(--serif);
  205. font-weight: 700;
  206. font-size: calc(40px * var(--scale));
  207. line-height: 1;
  208. letter-spacing: -0.02em;
  209. color: var(--accent);
  210. transition: color calc(220ms * var(--motion-mult)) ease;
  211. }
  212. .stat .lbl {
  213. font-size: calc(13px * var(--scale));
  214. color: var(--muted);
  215. max-width: 22ch;
  216. line-height: 1.45;
  217. }
  218. /* ============ Features grid ============ */
  219. .features {
  220. padding: calc(80px * var(--density)) 0 calc(40px * var(--density));
  221. }
  222. .section-title {
  223. font-family: var(--serif);
  224. font-weight: 600;
  225. font-size: calc(34px * var(--scale));
  226. letter-spacing: -0.015em;
  227. margin: 0 0 calc(48px * var(--density));
  228. max-width: 22ch;
  229. }
  230. .feat-grid {
  231. display: grid;
  232. grid-template-columns: repeat(3, 1fr);
  233. gap: calc(28px * var(--density));
  234. }
  235. @media (max-width: 880px) {
  236. .feat-grid { grid-template-columns: 1fr; }
  237. }
  238. .feat {
  239. padding: calc(28px * var(--density));
  240. background: var(--paper);
  241. border: 1px solid var(--rule);
  242. border-radius: 10px;
  243. transition: background calc(220ms * var(--motion-mult)) ease,
  244. border-color calc(220ms * var(--motion-mult)) ease,
  245. transform calc(220ms * var(--motion-mult)) ease;
  246. }
  247. .feat:hover { transform: translateY(-2px); }
  248. .feat .ico {
  249. width: 36px; height: 36px;
  250. border-radius: 8px;
  251. background: color-mix(in oklch, var(--accent) 18%, transparent);
  252. color: var(--accent);
  253. display: grid;
  254. place-items: center;
  255. font-family: var(--serif);
  256. font-weight: 700;
  257. font-size: calc(15px * var(--scale));
  258. margin-bottom: calc(20px * var(--density));
  259. }
  260. .feat h3 {
  261. font-family: var(--serif);
  262. font-weight: 600;
  263. font-size: calc(20px * var(--scale));
  264. margin: 0 0 calc(8px * var(--density));
  265. letter-spacing: -0.01em;
  266. }
  267. .feat p {
  268. color: var(--muted);
  269. font-size: calc(15px * var(--scale));
  270. line-height: 1.55;
  271. margin: 0;
  272. }
  273. /* ============ CTA banner ============ */
  274. .banner {
  275. margin: calc(60px * var(--density)) 0 calc(40px * var(--density));
  276. padding: calc(56px * var(--density)) calc(48px * var(--density));
  277. background: var(--ink);
  278. color: var(--bg);
  279. border-radius: 14px;
  280. display: grid;
  281. grid-template-columns: 1fr auto;
  282. gap: calc(40px * var(--density));
  283. align-items: center;
  284. transition: background calc(220ms * var(--motion-mult)) ease,
  285. color calc(220ms * var(--motion-mult)) ease;
  286. }
  287. @media (max-width: 720px) {
  288. .banner { grid-template-columns: 1fr; }
  289. }
  290. .banner h2 {
  291. font-family: var(--serif);
  292. font-weight: 600;
  293. font-size: calc(32px * var(--scale));
  294. letter-spacing: -0.015em;
  295. line-height: 1.15;
  296. margin: 0 0 calc(8px * var(--density));
  297. max-width: 22ch;
  298. }
  299. .banner p {
  300. color: rgba(244,241,234,0.68);
  301. font-size: calc(15px * var(--scale));
  302. margin: 0;
  303. }
  304. [data-mode="dark"] .banner p { color: rgba(26,26,28,0.68); }
  305. .ft {
  306. display: flex;
  307. justify-content: space-between;
  308. flex-wrap: wrap;
  309. gap: 16px;
  310. padding: calc(28px * var(--density)) 0;
  311. border-top: 1px solid var(--rule);
  312. font-family: var(--mono);
  313. font-size: calc(11px * var(--scale));
  314. letter-spacing: 0.18em;
  315. text-transform: uppercase;
  316. color: var(--muted);
  317. }
  318. /* =========================================================
  319. PANEL · same primitives as assets/wrap.html
  320. ========================================================= */
  321. .tw-panel {
  322. position: fixed;
  323. top: 16px;
  324. right: 16px;
  325. z-index: 100;
  326. width: 280px;
  327. max-width: calc(100vw - 32px);
  328. background: var(--paper);
  329. border: 1px solid var(--rule);
  330. border-radius: 8px;
  331. box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  332. font-family: var(--sans);
  333. transition: transform calc(220ms * var(--motion-mult)) cubic-bezier(.2,.8,.2,1),
  334. opacity calc(220ms * var(--motion-mult)) ease,
  335. background calc(220ms * var(--motion-mult)) ease;
  336. }
  337. [data-mode="dark"] .tw-panel { box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
  338. .tw-panel.tw-hidden {
  339. transform: translateX(calc(100% + 32px));
  340. opacity: 0;
  341. pointer-events: none;
  342. }
  343. .tw-head {
  344. display: flex;
  345. justify-content: space-between;
  346. align-items: center;
  347. padding: 14px 18px;
  348. border-bottom: 1px solid var(--rule);
  349. }
  350. .tw-head .ttl {
  351. font-family: var(--mono);
  352. font-size: 10px;
  353. letter-spacing: 0.24em;
  354. text-transform: uppercase;
  355. color: var(--muted);
  356. }
  357. .tw-head .toggle {
  358. background: transparent;
  359. border: 1px solid var(--rule);
  360. color: var(--muted);
  361. width: 24px; height: 24px;
  362. border-radius: 4px;
  363. cursor: pointer;
  364. font-family: var(--mono);
  365. font-size: 11px;
  366. padding: 0;
  367. }
  368. .tw-head .toggle:hover { color: var(--ink); }
  369. .tw-body { padding: 14px 18px 18px; }
  370. .tw-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
  371. .tw-row:last-child { margin-bottom: 0; }
  372. .tw-row .lbl {
  373. font-family: var(--mono);
  374. font-size: 10px;
  375. letter-spacing: 0.22em;
  376. text-transform: uppercase;
  377. color: var(--muted);
  378. }
  379. .tw-seg {
  380. display: flex;
  381. border: 1px solid var(--rule);
  382. border-radius: 5px;
  383. overflow: hidden;
  384. background: var(--bg);
  385. }
  386. .tw-seg button {
  387. flex: 1;
  388. padding: 7px 8px;
  389. background: transparent;
  390. border: 0;
  391. border-left: 1px solid var(--rule);
  392. cursor: pointer;
  393. font-family: var(--sans);
  394. font-size: 12px;
  395. font-weight: 500;
  396. color: var(--muted);
  397. transition: color calc(180ms * var(--motion-mult)) ease,
  398. background calc(180ms * var(--motion-mult)) ease;
  399. }
  400. .tw-seg button:first-child { border-left: 0; }
  401. .tw-seg button:hover { color: var(--ink); }
  402. .tw-seg button[aria-pressed='true'] {
  403. background: var(--paper);
  404. color: var(--ink);
  405. box-shadow: inset 0 -2px 0 var(--accent);
  406. }
  407. .tw-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
  408. .tw-swatch {
  409. width: 100%; aspect-ratio: 1;
  410. border: 2px solid transparent;
  411. border-radius: 5px;
  412. cursor: pointer;
  413. padding: 0;
  414. transition: transform calc(160ms * var(--motion-mult)) ease,
  415. border-color calc(160ms * var(--motion-mult)) ease;
  416. }
  417. .tw-swatch:hover { transform: scale(1.06); }
  418. .tw-swatch[aria-pressed='true'] { border-color: var(--ink); }
  419. .tw-foot {
  420. display: flex;
  421. justify-content: space-between;
  422. align-items: center;
  423. padding: 10px 18px;
  424. border-top: 1px solid var(--rule);
  425. font-family: var(--mono);
  426. font-size: 10px;
  427. letter-spacing: 0.18em;
  428. text-transform: uppercase;
  429. color: var(--muted);
  430. }
  431. .tw-foot button {
  432. background: transparent;
  433. border: 0;
  434. color: var(--muted);
  435. cursor: pointer;
  436. padding: 0;
  437. font: inherit;
  438. letter-spacing: inherit;
  439. text-transform: inherit;
  440. }
  441. .tw-foot button:hover { color: var(--ink); }
  442. kbd {
  443. font-family: var(--mono);
  444. font-size: 9px;
  445. padding: 2px 5px;
  446. border: 1px solid var(--rule);
  447. border-radius: 3px;
  448. color: var(--ink);
  449. }
  450. .tw-restore {
  451. position: fixed;
  452. top: 16px; right: 16px;
  453. z-index: 100;
  454. width: 36px; height: 36px;
  455. border-radius: 50%;
  456. border: 1px solid var(--rule);
  457. background: var(--paper);
  458. color: var(--ink);
  459. font-family: var(--mono);
  460. font-size: 13px;
  461. font-weight: 500;
  462. cursor: pointer;
  463. display: none;
  464. align-items: center;
  465. justify-content: center;
  466. transition: transform calc(180ms * var(--motion-mult)) ease;
  467. }
  468. .tw-restore:hover { transform: scale(1.06); }
  469. .tw-restore.tw-show { display: flex; }
  470. @media (max-width: 720px) {
  471. .tw-panel { left: 16px; right: 16px; width: auto; }
  472. }
  473. </style>
  474. </head>
  475. <body>
  476. <div class="wrap">
  477. <!-- Nav -->
  478. <nav class="nav">
  479. <div class="brand">
  480. <span class="brand-mark" aria-hidden="true"></span>
  481. <span>Filebase</span>
  482. </div>
  483. <div class="nav-links">
  484. <a href="#">Product</a>
  485. <a href="#">Pricing</a>
  486. <a href="#">Docs</a>
  487. <a href="#">Changelog</a>
  488. <a href="#">Customers</a>
  489. </div>
  490. <a class="cta" href="#">Start free</a>
  491. </nav>
  492. <!-- Hero -->
  493. <header class="hero">
  494. <div>
  495. <div class="eyebrow">Series B · 2026</div>
  496. <h1 class="h1">The bandwidth bill is the <em>bug</em>.</h1>
  497. <p class="lede">A sync engine that ships only what changed. 38× less data over the wire on real customer workloads.</p>
  498. <div class="row">
  499. <a class="cta" href="#">Start free</a>
  500. <span class="secondary">no card required</span>
  501. </div>
  502. </div>
  503. <div class="hero-card">
  504. <div class="label">filebase sync — typical run</div>
  505. <pre><span class="c">// hourly cron · feature/render-pass branch</span>
  506. $ filebase sync --watch
  507. <span class="k">→</span> diff: <span class="ok">12.4 MB</span> <span class="c">(of 4.7 GB)</span>
  508. <span class="k">→</span> upload: <span class="ok">8.2 MB</span> <span class="c">(deduplicated)</span>
  509. <span class="k">→</span> latency: <span class="ok">340 ms</span> <span class="c">p99</span>
  510. <span class="ok">✓ done in 2.1s</span></pre>
  511. </div>
  512. </header>
  513. <!-- Stats -->
  514. <section class="stats">
  515. <div class="stat">
  516. <div class="num">38×</div>
  517. <div class="lbl">less data moved over the wire vs naive sync</div>
  518. </div>
  519. <div class="stat">
  520. <div class="num">3,184</div>
  521. <div class="lbl">paying teams across post-production, design, ML</div>
  522. </div>
  523. <div class="stat">
  524. <div class="num">99.99%</div>
  525. <div class="lbl">uptime over the last 12 rolling months</div>
  526. </div>
  527. <div class="stat">
  528. <div class="num">$2.1M</div>
  529. <div class="lbl">aggregate egress savings reported by Q1 cohort</div>
  530. </div>
  531. </section>
  532. <!-- Features -->
  533. <section class="features">
  534. <h2 class="section-title">Three reasons teams switch in the first month.</h2>
  535. <div class="feat-grid">
  536. <article class="feat">
  537. <div class="ico" aria-hidden="true">∂</div>
  538. <h3>Block-level diffs</h3>
  539. <p>Edit one frame in a 4 GB Final Cut project; sync 12 MB. The diff doesn't care how big your file is — it cares what changed.</p>
  540. </article>
  541. <article class="feat">
  542. <div class="ico" aria-hidden="true">≈</div>
  543. <h3>Cross-region dedup</h3>
  544. <p>Your team in Berlin uploads a checkpoint your team in Tokyo already pushed. We notice. Nothing transfers.</p>
  545. </article>
  546. <article class="feat">
  547. <div class="ico" aria-hidden="true">∇</div>
  548. <h3>Drop-in for S3 / GCS</h3>
  549. <p>Wire one env var, change zero application code. Existing buckets, existing IAM, new bandwidth bill.</p>
  550. </article>
  551. </div>
  552. </section>
  553. <!-- CTA banner -->
  554. <section class="banner">
  555. <div>
  556. <h2>Pay for storage. Stop paying for movement.</h2>
  557. <p>Start free, no card required. Production teams in 14 days or fewer.</p>
  558. </div>
  559. <a class="cta" href="#" style="background: var(--accent); color: #fff;">Book a demo</a>
  560. </section>
  561. <footer class="ft">
  562. <span>© 2026 Filebase, Inc.</span>
  563. <span>Privacy · Terms · Status</span>
  564. <span>built with the OD tweaks skill</span>
  565. </footer>
  566. </div>
  567. <!-- ============ Tweak panel ============ -->
  568. <aside class="tw-panel" id="tw-panel" aria-label="Tweak panel">
  569. <header class="tw-head">
  570. <span class="ttl">Tweaks · Filebase</span>
  571. <button class="toggle" id="tw-close" aria-label="Hide panel" title="Hide (T)">×</button>
  572. </header>
  573. <div class="tw-body">
  574. <div class="tw-row">
  575. <span class="lbl">Accent</span>
  576. <div class="tw-swatches" id="tw-accent" role="radiogroup" aria-label="Accent color"></div>
  577. </div>
  578. <div class="tw-row">
  579. <span class="lbl">Mode</span>
  580. <div class="tw-seg" id="tw-mode" role="radiogroup" aria-label="Color mode">
  581. <button data-val="light" aria-pressed="true">Light</button>
  582. <button data-val="dark" aria-pressed="false">Dark</button>
  583. </div>
  584. </div>
  585. <div class="tw-row">
  586. <span class="lbl">Type scale</span>
  587. <div class="tw-seg" id="tw-scale" role="radiogroup" aria-label="Type scale">
  588. <button data-val="0.85" aria-pressed="false">Compact</button>
  589. <button data-val="1" aria-pressed="true">Normal</button>
  590. <button data-val="1.15" aria-pressed="false">Generous</button>
  591. </div>
  592. </div>
  593. <div class="tw-row">
  594. <span class="lbl">Density</span>
  595. <div class="tw-seg" id="tw-density" role="radiogroup" aria-label="Density">
  596. <button data-val="0.75" aria-pressed="false">Tight</button>
  597. <button data-val="1" aria-pressed="true">Normal</button>
  598. <button data-val="1.4" aria-pressed="false">Roomy</button>
  599. </div>
  600. </div>
  601. <div class="tw-row">
  602. <span class="lbl">Motion</span>
  603. <div class="tw-seg" id="tw-motion" role="radiogroup" aria-label="Motion">
  604. <button data-val="0" aria-pressed="false">Off</button>
  605. <button data-val="1" aria-pressed="true">Subtle</button>
  606. <button data-val="1.6" aria-pressed="false">Lively</button>
  607. </div>
  608. </div>
  609. </div>
  610. <footer class="tw-foot">
  611. <span><kbd>T</kbd> hide · <kbd>R</kbd> reset</span>
  612. <button id="tw-reset" type="button">Reset</button>
  613. </footer>
  614. </aside>
  615. <button class="tw-restore" id="tw-restore" aria-label="Show panel" title="Show panel (T)">T</button>
  616. <script>
  617. const STORAGE_KEY = 'tweaks-filebase-example';
  618. const ACCENT_PRESETS = [
  619. { id: 'rust', val: '#c96442' },
  620. { id: 'cobalt', val: '#2c4d8e' },
  621. { id: 'sage', val: '#4a7a3f' },
  622. { id: 'plum', val: '#7a3f6a' },
  623. { id: 'graphite', val: '#3a3a3a' },
  624. ];
  625. const DEFAULTS = {
  626. accent: ACCENT_PRESETS[0].val,
  627. mode: 'light',
  628. scale: 1,
  629. density: 1,
  630. motion: matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 1,
  631. };
  632. function load() {
  633. try {
  634. const raw = localStorage.getItem(STORAGE_KEY);
  635. if (!raw) return { ...DEFAULTS };
  636. return { ...DEFAULTS, ...JSON.parse(raw) };
  637. } catch { return { ...DEFAULTS }; }
  638. }
  639. function save(s) {
  640. try { localStorage.setItem(STORAGE_KEY, JSON.stringify(s)); } catch {}
  641. }
  642. function applyState(s) {
  643. const r = document.documentElement;
  644. r.style.setProperty('--accent', s.accent);
  645. r.style.setProperty('--scale', s.scale);
  646. r.style.setProperty('--density', s.density);
  647. r.style.setProperty('--motion-mult', s.motion);
  648. r.setAttribute('data-mode', s.mode);
  649. paintAccent(s.accent);
  650. paintSeg('tw-mode', s.mode);
  651. paintSeg('tw-scale', String(s.scale));
  652. paintSeg('tw-density', String(s.density));
  653. paintSeg('tw-motion', String(s.motion));
  654. }
  655. function paintAccent(val) {
  656. document.querySelectorAll('#tw-accent button').forEach((b) =>
  657. b.setAttribute('aria-pressed', b.dataset.val === val ? 'true' : 'false'),
  658. );
  659. }
  660. function paintSeg(id, val) {
  661. document.querySelectorAll('#' + id + ' button').forEach((b) =>
  662. b.setAttribute('aria-pressed', b.dataset.val === val ? 'true' : 'false'),
  663. );
  664. }
  665. function buildAccent(state) {
  666. const host = document.getElementById('tw-accent');
  667. host.innerHTML = '';
  668. for (const p of ACCENT_PRESETS) {
  669. const b = document.createElement('button');
  670. b.type = 'button';
  671. b.className = 'tw-swatch';
  672. b.dataset.val = p.val;
  673. b.setAttribute('aria-label', p.id);
  674. b.style.background = p.val;
  675. b.addEventListener('click', () => {
  676. state.accent = p.val;
  677. save(state); applyState(state);
  678. });
  679. host.appendChild(b);
  680. }
  681. }
  682. function bindSeg(id, key, parser) {
  683. document.getElementById(id).addEventListener('click', (e) => {
  684. const btn = e.target.closest('button[data-val]');
  685. if (!btn) return;
  686. state[key] = parser ? parser(btn.dataset.val) : btn.dataset.val;
  687. save(state); applyState(state);
  688. });
  689. }
  690. const state = load();
  691. buildAccent(state);
  692. bindSeg('tw-mode', 'mode');
  693. bindSeg('tw-scale', 'scale', parseFloat);
  694. bindSeg('tw-density', 'density', parseFloat);
  695. bindSeg('tw-motion', 'motion', parseFloat);
  696. applyState(state);
  697. const panel = document.getElementById('tw-panel');
  698. const restore = document.getElementById('tw-restore');
  699. function setPanelVisible(v) {
  700. panel.classList.toggle('tw-hidden', !v);
  701. restore.classList.toggle('tw-show', !v);
  702. }
  703. document.getElementById('tw-close').addEventListener('click', () => setPanelVisible(false));
  704. restore.addEventListener('click', () => setPanelVisible(true));
  705. document.getElementById('tw-reset').addEventListener('click', () => {
  706. Object.assign(state, DEFAULTS);
  707. save(state); applyState(state);
  708. });
  709. addEventListener('keydown', (e) => {
  710. if (e.metaKey || e.ctrlKey || e.altKey) return;
  711. if (e.target.matches('input, textarea, select, [contenteditable]')) return;
  712. if (e.key === 't' || e.key === 'T') {
  713. e.preventDefault();
  714. setPanelVisible(panel.classList.contains('tw-hidden'));
  715. } else if (e.key === 'r' || e.key === 'R') {
  716. e.preventDefault();
  717. Object.assign(state, DEFAULTS);
  718. save(state); applyState(state);
  719. }
  720. });
  721. </script>
  722. </body>
  723. </html>