onlyn00bs-badge

OnlyN00bs: a DEF CON 34 friend-finder badge. ESP32 firmware, Web Bluetooth setup app, printable case
git clone https://git.virtualshack.io/onlyn00bs-badge.git
Log | Files | Refs | README | LICENSE

badge.css (11070B)


      1 /* badge.virtualshack.io — shared shell
      2  *
      3  * Palette rule: parent-site chrome
      4  * from virtualshack.io (hugo-coder dark: #212121 / #dadada / #42a5f5) with the
      5  * badge's mint #3ddc97 kept as the sub-brand accent. The `//` heading motif
      6  * mirrors the device OLED (// home, // storage, // options) — that through-line
      7  * from screen → page → docs is the brand, keep it.
      8  *
      9  * Parent site is colorscheme-auto, so we honour prefers-color-scheme too.
     10  */
     11 
     12 :root {
     13   --bg: #212121;          /* virtualshack.io dark bg */
     14   --fg: #dadada;
     15   --link: #22d3ee;        /* virtualshack accents (STYLE.md): cyan links, */
     16   --hover: #ff79c6;       /* pink hover/focus, */
     17   --focus: #9b8cff;       /* blue-purple focus ring */
     18   --accent: #3ddc97;      /* badge sub-brand mint */
     19   --panel: #2b2b2b;
     20   --rule: #424242;
     21   --code-bg: #4f4f4f;
     22   --muted: #8b949e;
     23   --warn: #ffb454;
     24   --err: #ff5370;
     25 }
     26 
     27 @media (prefers-color-scheme: light) {
     28   :root {
     29     --bg: #fafafa;
     30     --fg: #212121;
     31     --link: #0e7490;
     32     --hover: #c2185b;
     33     --focus: #5b4fe0;
     34     --accent: #0a7f50;    /* mint for white: 4.8:1 (#0f9d63 was 3.3:1, failed AA) */
     35     --panel: #efefef;
     36     --rule: #d5d5d5;
     37     --code-bg: #e4e4e4;
     38     --muted: #5c6570;
     39     --warn: #a05e00;
     40     --err: #c62828;
     41   }
     42 }
     43 
     44 /* Per-page accent swap: <body class="theme-purple"> trades the mint for the purple of
     45    .cta.purple (used on /update/). Light mode gets the darker focus purple: 5.9:1 on #fafafa. */
     46 .theme-purple { --accent: #9b8cff; }
     47 @media (prefers-color-scheme: light) { .theme-purple { --accent: #5b4fe0; } }
     48 
     49 * { box-sizing: border-box; }
     50 
     51 body {
     52   margin: 0;
     53   background: var(--bg);
     54   color: var(--fg);
     55   font: 15px/1.65 ui-monospace, Menlo, Consolas, monospace;
     56   -webkit-text-size-adjust: 100%;
     57 }
     58 
     59 .wrapper { max-width: 780px; margin: 0 auto; padding: 32px 20px 64px; }
     60 
     61 /* Links are never underlined (STYLE.md): hover/focus is the colour change, keyboard focus
     62    also gets the ring. */
     63 a { color: var(--link); text-decoration: none; transition: color .15s ease; }
     64 a:hover, a:focus { color: var(--hover); text-decoration: none; }
     65 a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
     66 
     67 h1, h2, h3 { line-height: 1.3; font-weight: 700; }
     68 h1 { font-size: 26px; margin: 0 0 6px; color: var(--accent); letter-spacing: .5px; }
     69 h2 { font-size: 18px; margin: 40px 0 12px; color: var(--accent); scroll-margin-top: 16px; }
     70 h3 { font-size: 15px; margin: 24px 0 8px; color: var(--fg); }
     71 
     72 p, li { margin: 0 0 12px; }
     73 ul, ol { padding-left: 22px; }
     74 
     75 code {
     76   background: var(--code-bg);
     77   color: var(--fg);
     78   padding: 1px 5px;
     79   border-radius: 3px;
     80   font-size: .92em;
     81 }
     82 
     83 pre {
     84   background: var(--panel);
     85   border: 1px solid var(--rule);
     86   border-radius: 8px;
     87   padding: 14px 16px;
     88   overflow-x: auto;          /* diagrams scroll themselves; the page never does */
     89   font-size: 13px;
     90   line-height: 1.5;
     91 }
     92 pre code { background: none; padding: 0; }
     93 
     94 .tagline { color: var(--muted); margin: 0 0 4px; }
     95 .muted { color: var(--muted); }
     96 .small { font-size: 13px; }
     97 
     98 hr { border: 0; border-top: 1px solid var(--rule); margin: 36px 0; }
     99 
    100 /* callouts — one shape, three severities */
    101 .note {
    102   border-left: 3px solid var(--link);
    103   background: var(--panel);
    104   padding: 12px 16px;
    105   border-radius: 0 8px 8px 0;
    106   margin: 16px 0;
    107 }
    108 .note.warn { border-left-color: var(--warn); }
    109 .note.stop { border-left-color: var(--err); }
    110 .note :last-child { margin-bottom: 0; }
    111 .note b { color: var(--fg); }
    112 /* .log is a density modifier, not a fourth severity — the changelog is a list of many
    113    short items, and the default 12px gap between them makes the callout enormous. */
    114 .note.log ul { margin: 6px 0 0; }
    115 .note.log li { margin: 0 0 6px; }
    116 
    117 /* the big call-to-action to the provisioning app */
    118 .cta {
    119   display: inline-block;
    120   margin: 8px 0 4px;
    121   padding: 12px 20px;
    122   background: #3ddc97;        /* bright mint in BOTH themes: the dark label is 10.8:1 on it,
    123                                   but only 3.8:1 on the light-mode TEXT mint (#0a7f50) */
    124   color: #08110b;
    125   font-weight: 700;
    126   border-radius: 8px;
    127 }
    128 .cta:hover, .cta:focus { color: #08110b; text-decoration: none; opacity: .9; }  /* keep the dark label: a:hover would turn it pink */
    129 
    130 /* Purple variant, for a secondary CTA beside the mint one. Same dark label: 7.0:1 on it. */
    131 .cta.purple { background: #9b8cff; }
    132 
    133 /* Non-link CTA while the setup app isn't hosted yet: same shape, but muted and inert. */
    134 .cta.disabled {
    135   cursor: default;
    136   background: var(--panel);
    137   color: var(--muted);
    138   border: 1px solid var(--rule);
    139 }
    140 .cta .soon { font-weight: 400; font-size: 13px; opacity: .85; }
    141 
    142 /* Back-to-top link above the footer. */
    143 .totop {
    144   display: inline-block;
    145   margin: 32px 0 8px;
    146   font-size: 13px;
    147   color: var(--muted);
    148 }
    149 .totop:hover, .totop:focus { color: var(--accent); text-decoration: none; }
    150 
    151 /* table of contents */
    152 .toc { border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px 6px; margin: 24px 0; }
    153 .toc ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 24px; }
    154 .toc li { margin: 0 0 6px; }
    155 @media (max-width: 520px) { .toc ul { columns: 1; } }
    156 
    157 /* ── photos ──────────────────────────────────────────────────────────────────
    158    Usage:
    159      <figure>
    160        <img src="assets/photo-badge.jpg" alt="a badge, screen lit, showing HOME"
    161             width="1600" height="1200" loading="lazy" decoding="async">
    162        <figcaption>the whole point</figcaption>
    163      </figure>
    164    Always set width/height (the real pixel dimensions) — the browser reserves the
    165    space before the file loads, so nothing jumps as photos stream in on con wifi.
    166    loading="lazy" on everything below the fold; NOT on the first/hero image, which
    167    should load immediately. A faint border keeps a dark photo from bleeding into
    168    the dark page background. */
    169 img { max-width: 100%; height: auto; display: block; }
    170 
    171 figure {
    172   margin: 24px 0;
    173 }
    174 figure img {
    175   width: 100%;
    176   border: 1px solid var(--rule);
    177   border-radius: 8px;
    178   background: var(--panel);      /* shows while the image is still decoding */
    179 }
    180 figcaption {
    181   margin-top: 8px;
    182   font-size: 13px;
    183   color: var(--muted);
    184   text-align: center;
    185 }
    186 
    187 /* Clickable photo: small inline, full resolution in a new tab.
    188    The <img> points at a ~900px thumbnail (assets/img/thumbs/), the <a> at the original —
    189    so the page loads ~0.5MB instead of ~1.7MB, which matters on con wifi, and the detail
    190    is still one click away. */
    191 a.photo {
    192   display: block;
    193   max-width: 420px;
    194   margin: 20px auto;
    195   text-decoration: none;
    196 }
    197 a.photo img {
    198   width: 100%;
    199   height: auto;
    200   border: 1px solid var(--rule);
    201   border-radius: 8px;
    202   background: var(--panel);           /* holds the space while decoding */
    203   transition: border-color .15s ease, opacity .15s ease;
    204 }
    205 a.photo:hover img,
    206 a.photo:focus-visible img { border-color: var(--accent); opacity: .9; }
    207 a.photo:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
    208 
    209 /* Persistent hint — without it nobody discovers the images are clickable. */
    210 a.photo::after {
    211   content: "click to enlarge ⤢";
    212   display: block;
    213   margin-top: 6px;
    214   font-size: 12px;
    215   color: var(--muted);
    216   text-align: center;
    217 }
    218 a.photo:hover::after,
    219 a.photo:focus-visible::after { color: var(--accent); }
    220 
    221 /* Portrait shots pair up nicely; .shots handles the collapse on narrow screens. */
    222 .shots a.photo { max-width: none; margin: 0; }
    223 
    224 /* Two or more photos side by side; collapses to one column on a phone. */
    225 .shots {
    226   display: grid;
    227   grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    228   gap: 16px;
    229   margin: 24px 0;
    230 }
    231 .shots figure { margin: 0; }
    232 
    233 dl { margin: 0; }
    234 dt { color: var(--accent); margin-top: 16px; }
    235 dd { margin: 4px 0 0; }
    236 
    237 footer {
    238   margin-top: 56px;
    239   padding-top: 16px;
    240   border-top: 1px solid var(--rule);
    241   color: var(--muted);
    242   font-size: 13px;
    243 }
    244 
    245 /* offline/browser banners injected by JS */
    246 #banner { display: none; }
    247 #banner.show { display: block; }
    248 
    249 /* ── gallery (gallery/index.html) ────────────────────────────────────────────
    250    Tiles are uniform 4:3 crops of the thumbnail (object-fit), so a mix of portrait and
    251    landscape shots still lines up; the full, uncropped photo is one click away. Grid and
    252    <img> markup are generated from the gallery manifest. */
    253 .gallery {
    254   display: grid;
    255   grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    256   gap: 12px;
    257   margin: 24px 0;
    258 }
    259 @media (max-width: 520px) { .gallery { grid-template-columns: 1fr 1fr; gap: 8px; } }
    260 .gallery figure { margin: 0; }
    261 .gallery a { display: block; border-radius: 8px; }
    262 .gallery img {
    263   width: 100%;
    264   aspect-ratio: 4 / 3;
    265   object-fit: cover;
    266   border: 1px solid var(--rule);
    267   border-radius: 8px;
    268   background: var(--panel);
    269   transition: border-color .15s ease, opacity .15s ease;
    270 }
    271 .gallery a:hover img, .gallery a:focus-visible img { border-color: var(--accent); opacity: .9; }
    272 .gallery a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
    273 .gallery figcaption { margin-top: 6px; font-size: 12px; color: var(--muted); }
    274 
    275 /* Lightbox: a full-viewport <dialog>. Always dark — it's a photo viewer, not page chrome.
    276    The figure ignores pointer events so a click on empty space reaches the dialog (= close). */
    277 dialog.lightbox {
    278   width: 100vw; height: 100vh; max-width: none; max-height: none;
    279   margin: 0; padding: 56px 16px 24px; border: 0;
    280   background: rgba(10, 10, 10, .97);
    281   color: #dadada;
    282 }
    283 dialog.lightbox::backdrop { background: rgba(0, 0, 0, .6); }
    284 dialog.lightbox figure {
    285   margin: 0; height: 100%;
    286   display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    287   pointer-events: none;
    288 }
    289 dialog.lightbox img {
    290   width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 130px);
    291   border-radius: 6px; pointer-events: auto;
    292 }
    293 dialog.lightbox figcaption { font-size: 13px; color: #bdbdbd; text-align: center; }
    294 .lightbox button {
    295   position: fixed;
    296   min-width: 44px; min-height: 44px;               /* thumb-sized */
    297   font: 20px/1 ui-monospace, Menlo, Consolas, monospace;
    298   color: #dadada; background: rgba(43, 43, 43, .85);
    299   border: 1px solid #424242; border-radius: 8px; cursor: pointer;
    300 }
    301 .lightbox button:hover, .lightbox button:focus-visible { border-color: #ff79c6; color: #ff79c6; outline: none; }
    302 .lightbox .close { top: 8px; right: 12px; }
    303 .lightbox .prev { left: 12px; top: 50%; transform: translateY(-50%); }
    304 .lightbox .next { right: 12px; top: 50%; transform: translateY(-50%); }
    305 .lightbox .count { position: fixed; top: 20px; left: 16px; font-size: 13px; color: #8b949e; }
    306 
    307 /* The badge page's // photos section: the gallery's first row (three tiles). On a phone the
    308    grid is two columns, so the third would sit alone on a second row: show two instead. */
    309 @media (max-width: 520px) { .gallery-preview figure:nth-child(n+3) { display: none; } }