AI Instructions (llms.txt)

The llms.txt file holds molique's golden rules and class dictionary in one place - point an AI assistant (Claude, ChatGPT, and others) at it, and it'll generate markup that follows the framework instead of inventing classes. This page is its human-readable version - generated from the same file, so it can never drift from it.

Raw file for AI agents

This is the address AI tools actually read - /llms.txt, a plain text file, no HTML.

View raw llms.txt

Context: A lightweight, rigorously optimized B2B CSS framework.

1. GOLDEN RULES (CORE RULES)

  • Native HTML5/CSS over JS: Always prefer native solutions (<dialog>, <details>, :user-invalid, scroll-snap, popover). JS is a last resort.
  • Zero specificity wars: CSS is built on @layer cascade layers. No !important allowed (except for utility classes in @layer utilities).
  • B2B Accessibility (A11y): Interactive elements (button, input) must have min-height: 44px (variable --target-size-min). The exception is .btn-action buttons in dense tables.
  • GPU performance: Animations may only modify transform, scale, translate, and opacity. Never animate box-shadow, width, height (avoid reflow).

2. CLASS DICTIONARY & HTML STRUCTURES (CHEAT SHEET)

Layout & Grid

  • Smart Grid (Auto): .grid-auto, .grid-auto-sm, .grid-auto-lg. (Arranges columns automatically).
  • Fixed Grid: Parent .grid-cols-1 through 12. Children .col-span-1 through 12. The .grid-md-cols-* and .grid-lg-cols-* variants are single-column by DEFAULT below their own breakpoint, so class="grid-md-cols-12" is enough - adding grid-cols-1 changes nothing.
  • GOLDEN GRID RULE (RWD): On mobile devices (inside .grid-cols-1) NEVER use .col-span-* classes. Elements take up 100% width by default. Use ONLY classes with the -md- prefix (e.g. .col-md-span-6) to define the desktop layout! Using .col-span-12 on mobile will break the layout.
  • Offsets (Grid): .col-start-1 through 12 OR the classic .offset-1 through 11 (plus -md-, -lg- variants). Lets you shift elements within the grid.
  • Flexbox: .d-flex, .flex-column, .align-items-center, .justify-content-between, .gap-1 through .gap-5. Single child: .align-self-start/-end/-center/-stretch.
  • Spacing: .m-1 through .m-5, .p-1 through .p-5 (plus -md- variants, e.g. .p-md-4). Pulling upward (negative margin): .overlap-up-50/-100/-150.
  • Positioning: .position-relative/-absolute/-fixed/-sticky; edges .top-0/.bottom-0/.left-0/.right-0/.inset-0; centering .top-50+.left-50+.translate-middle(-x/-y). Sizing: .w-25/-50/-75/-100/-auto, .mw-100, .min-vh-100.
  • Breakout (Full-bleed on mobile): .breakout-mobile - pulls an element out of .container's padding below 768px, all the way to the screen edge (carousels, galleries, a hero image inside body text). No effect on desktop. Viewport centering (width:100vw + margin-left:50% + translateX(-50%)) is calculated relative to the DIRECT parent, which must be centered in the window like .container - nesting it deeper (e.g. inside .card-body) breaks the result.
  • Bento Grid: .bento-grid > .bento-col-2, .bento-row-2.

Navigation (Navbar)

  • Base: .navbar > .navbar-container > .navbar-brand + .navbar-menu > .navbar-item.
  • Active item (current page): the .is-active class on .navbar-item (and .dropdown-item / .mega-menu-link) - primary color + heavier weight. Assigned from the URL by the js/modules/molique-navbar-active.js module (auto-loaded when .navbar-menu is present): highlights the current page's link AND the trigger of whichever dropdown menu it's inside. Do NOT write the active state into the markup - the navbar is often shared across pages, the script handles it from the address.
  • Variants: .navbar-transparent, .navbar-sticky (adds .is-scrolled).
  • Overlay variants (.navbar-transparent, .navbar-pill): position: absolute - the navbar sits ON TOP of the content, so a hero photo starts right from the top of the page. On scroll, JS adds .is-scrolled → position: fixed + theme background. Do NOT combine with .navbar-sticky (sticky returns to document flow and wins the cascade - the overlay stops working). Push hero content down by var(--navbar-h).
  • Pill: .navbar-pill - the navbar as a pill floating off the edge with its own background; after scrolling it unfolds into a bar at the edge. Background is ALWAYS dark (it sits over a photo), overridden via style="--navbar-pill-bg: #123". Both states have SEPARATE variables (an inline style beats a class rule, so one shared variable would block the other state): --navbar-pill-bg/--navbar-pill-color over the hero, --navbar-pill-bg-scrolled/--navbar-pill-color-scrolled after scrolling, --navbar-pill-padding-x (32px)/--navbar-pill-padding-x-scrolled (16px). Links stay white until scrolled. On mobile the offcanvas panel takes over --navbar-pill-bg (otherwise white links would land on the light --bg-surface); in .navbar-transparent, which has nothing to paint the panel with, links there fall back to --text-main.
  • Offcanvas (Mobile): Built on the Checkbox Hack (.navbar-offcanvas-toggle:checked).
  • Mega Menu: <details class="mega-menu" name="group"> > <summary class="navbar-item mega-menu-trigger"> + .mega-menu-content (inside: .mega-menu-group with .mega-menu-col-title and .mega-menu-link, optionally .mega-menu-featured). Opens on CLICK, not hover - native <details>, works from the keyboard and without JS. Degrades to an accordion in the offcanvas on mobile. name makes multiple mega menus mutually exclusive.
  • Dropdown (navbar): <details class="dropdown"> > <summary class="dropdown-toggle"> + .dropdown-menu.
  • Dropdown Popover (outside the navbar - top layer): any <button popovertarget="ID"> + .dropdown-menu with a popover attribute and a unique id - the menu is NOT clipped by overflow (tables, cards, modals) and anchors itself automatically to its button (implicit anchor, no .dropdown wrapper needed). Right-align with the added .dropdown-menu-end.
  • Theme Switch (light/dark): <label class="theme-switch"> > <input type="checkbox" id="theme-toggle" class="theme-switch-input"> + .theme-switch-track (with .theme-switch-thumb and .theme-icon-wrapper > .theme-icon.icon-sun / .theme-icon.icon-moon). id="theme-toggle" is REQUIRED - molique-script.js looks it up via getElementById; a different id or a second switch on the page = silent failure, no error. The choice lives in localStorage under molique-theme; on first visit it reads prefers-color-scheme; the theme is the data-theme attribute on <html>. Also read synchronously in <head> - see Admin Sidebar anti-FOUC below.
  • Language Switch (Popover): <button class="language-switch-trigger" popovertarget="ID"> (with .language-switch-flag + the language code) + .dropdown-menu.dropdown-menu-end.language-switch-menu with a popover attribute and id > .dropdown-item.language-switch-item (with .language-switch-flag, .language-switch-name, optionally .language-switch-check). Flags ONLY as separate SVG files from img/flags/ (<img src="img/flags/pl.svg" width="20" height="15" alt="">) - the folder only holds the languages actually offered in the project; NEVER emoji flags (they don't render on Windows) or an external sprite with <use> (doesn't work under file:// and is sometimes blocked by CORS). Real content translation: the reference implementation (flat files page.html/page.en.html/page.de.html, auto-hreflang, hiding languages without a translation for a given page) is documented in this repo's DOCS-PLAN.md and implemented in vite.config.js (computeI18nLocals).

UI & Business Components

  • Cards: .card > .card-header + .card-body + .card-footer. Variants: .featured-box, .thumb-info (with .thumb-info-wrapper).
  • Buttons: color (.btn-primary, secondary, success, danger, warning, info, dark, light) + size (.btn-xs, .btn-sm, .btn-md, .btn-lg, .btn-xl). A COLOR CLASS IMPLIES .btn - class="btn-primary" is enough, no need for class="btn btn-primary"; add plain .btn only for a colorless button. The implication only covers colors and their outline variants - size and base-look modifiers do NOT carry it, and .btn-action deliberately does not inherit it. Outline: .btn-outline-<color> for every color + .btn-outline-soft (30% border, 10% on hover). Grouping: .btn-group (current: .is-active). Default hover for every .btn: the .btn-hover-spring/-lift/-glow class on <body> (buttons with their own hover-* class take priority).
  • Buttons - look variants: .btn-3d (requires --btn-3d-shadow in the button's color, defaults to primary), .btn-glass (ON A PHOTO ONLY - blurs what's underneath; background and border use !important, you can't override them with a class), .btn-glow, .btn-gradient (primary → info, ignores the color class), .btn-shine, .btn-stacked (icon above the label; the label goes in .btn-text - a label, NOT a separate variant).
  • Ghost Buttons (Tables): .btn-action (e.g. for Edit/Delete actions). Grouping with dividers: .btn-action-group.with-dividers.
  • Badges: .badge + .badge-primary (or other colors).
  • Modals (Native): <dialog class="modal-dialog"> (or .modal-context for a side/bottom panel). Closing: <form method="dialog">.
  • Tabs: .tabs > hidden input.tab-input[type=radio] (shared name) + .tabs-header > label.tab-label + .tabs-content > .tab-pane. Panel order MUST match input order - CSS links them by position, not by name. The .tabs-pill variant with .tabs-pill-indicator (width computed from --tab-count). .tab-input is hidden with the clip technique (like .sr-only, NOT display: none), so the group keeps working with arrow-key navigation.
  • Accordions: <details class="accordion-item" name="group"> > <summary class="accordion-header"> + <div class="accordion-body">. The header is a flex with gap; the ::after arrow is pushed by margin-left: auto - several elements (e.g. a .badge plus text) stay left-aligned. Wrap a sentence containing <code> in a single <span>, otherwise gap will space it out as a separate flex item.
  • B2B Tables: .table-wrapper > <table class="table">. Variants: .table-sm, .table-lg, .table-striped, .table-hover, .table-borderless. Headers: .thead-light, .thead-dark, .thead-primary (plus sizes .thead-sm, .thead-lg).
  • Mobile Tables: Add .table-cards to <table>. Requires a data-label="Name" attribute on every <td> - CSS reads labels ONLY from there, it won't read them from <th>. The .table-cards-always variant does the same at every width.
  • List Group: .list-group > .list-group-item (current: .is-active). A vertical list of clickable items.
  • Counters: .counter > .counter-value + .counter-title. The target value is the CONTENT of .counter-value; js/modules/molique-counters.js (auto-loaded) counts up to it once it enters the viewport. Without JS the number is still visible, just without the animation.
  • Data Rows (CRM Grid): .data-row > divs with data + .data-row-actions.
  • Compact Data Rows (List Items): .data-row-compact > .row-icon + .row-content (with .row-title and .row-details) + .row-actions.
  • Pricing Tables: .pricing-table (add .is-featured to highlight one) > .pricing-header + .pricing-features.
  • Progress Bars: .progress > .progress-bar (width via style="width: X%"). NOTE: .progress-bar/.progress-bar-reading animate width (transition) - a conscious departure from the GPU-only rule.
  • Timeline: .timeline (variants: .timeline-large, .timeline-numbered) > .timeline-item.
  • Labeled Timeline (dates on the left): .timeline.timeline-labeled > .timeline-item > .timeline-label + .timeline-separator (with .timeline-node and .timeline-line) + .timeline-content.
  • Stepper: .stepper (variant: .stepper-numbered) > .step (add .is-active or .is-completed).

Forms (Zero JS Validation)

  • Floating Labels: .form-floating > input.input[placeholder=" "] + label + .feedback-invalid. Its own margin-bottom zeroes out as a direct child of .card-body (which has a gap) - outside .card-body it behaves normally.
  • Switches: <label class="form-switch"> > <input type="checkbox" class="form-switch-input"> + <span class="form-switch-label">. Variants: .form-switch-square, .form-switch-outline.
  • Input Groups: .input-group > .input-group-text + .input + .btn. (Automatically joins the elements into a smooth rectangle).
  • Advanced Inputs: .input-range, .input-color, input[type="date"].input, input[type="number"].input (no native spinner - stepping is handled by .qty-input with + / - buttons, the keyboard, and scroll).
  • Searchable Select (Popover API): .select-search > <button class="input select-search-trigger" popovertarget="ID"> + .select-search-menu with a popover attribute and a unique id (top layer - the menu is NOT clipped inside modals or scrolling containers). The search box (.select-search-input) is OPTIONAL - without it the component behaves like a plain select (just the option list). select.js uses event delegation (handles options added after page load, e.g. via AJAX); the hidden input gets a change event on selection; set the value from JS with MoliqueSelectSearch.setValue(hiddenInput, value).
  • Premium Multi Select (Popover API): .custom-select > <button class="custom-select-trigger" popovertarget="ID"> + .custom-select-dropdown with a popover attribute and a unique id (with .custom-select-category and .custom-select-option).
  • File Upload: .file-upload (variant: .file-upload-animated) > an invisible input[type="file"] stretched over the whole zone (click and drag&drop work natively). The auto-loaded js/modules/molique-file-upload.js listens for change and overwrites .file-upload-name with the file's name - the element is optional in the markup, the module will add it itself.

Feedback & Status

  • Toasts: Use the Popover API. Triggered from JS: MoliqueToast.show({ message: '...', type: 'success' }). message is TEXT (since v1.7.37 it goes in through textContent, markup shows literally) - HTML only on purpose with html: true, and only with content written entirely by the page code, never with data from a user or a server.
  • Status Dots: .status-dot + .status-draft / pending / done / danger. Add .status-ping for a pulsing effect.
  • Stock Bar (segmented stock level): .stock-bar + variant .stock-bar-success / -warning / -danger (no variant: secondary color). Filled from the backend via style="--stock-filled: 3" (0-5); segments are drawn by an SVG mask - zero JS and zero extra markup. The bar is purely visual: state the value as text alongside it, or add role="img" + aria-label.
  • Interactive Icon: .status-icon-toggle (Plus -> Checkmark animation). Can be used with <label class="status-checkbox">.
  • Tooltips: .tooltip-element[data-tooltip="Text"].

Modules: Admin, E-commerce, Blog

  • Admin Layout: .admin-layout > .admin-sidebar + .admin-main. The .admin-layout-floating variant pulls the content away from the edges.
  • Fade Bottom: .fade-bottom - fades content out at the bottom edge (a gradient instead of a hard cut). Works on any scrollable container: --fade-color = the container's background color (defaults to --bg-surface), height --fade-height (80px). On .admin-sidebar and .admin-main the color is picked automatically; on mobile the sidebar's gradient turns itself off.
  • Admin Sidebar: Width classes: .sidebar-md, .sidebar-sm (on .admin-layout). Logo handling on mobile: .admin-logo-hide, .admin-logo-compact.
  • Admin Sidebar - width toggle: <button id="molique-sidebar-toggle" class="admin-nav-link"> (an ID, one per page) + .sidebar-toggle-icon with exactly three empty <span>s (morphing hamburger → asymmetric lines → arrow). A click cycles .admin-layout between full / .sidebar-md / .sidebar-sm, remembered in localStorage (molique-sidebar-state). The logic lives permanently in the molique-script.js core, NOT in the autoloader. GOTCHA: a sample (non-real) .admin-nav-submenu[open] anywhere on the same page, outside the real sidebar, will turn into a full-screen invisible overlay once the page switches to .sidebar-md/.sidebar-sm - the drill-down selector is global, not scoped to .admin-sidebar.
  • Admin Sidebar - anti-FOUC: molique-theme/molique-sidebar-state from localStorage are only read on DOMContentLoaded in molique-script.js → a returning user with a collapsed sidebar/dark mode would see a split second of the full (lg) sidebar / light theme before it switches. The fix has two parts (copy them together): (1) a synchronous (no defer/async) inline <script> right at the top of <head> (partials/head.html), right after the viewport meta tag - it reads both keys and sets data-theme + the sidebar-md/sidebar-sm class on <html> BEFORE the first paint; (2) layout/_admin-layout.scss gets mirrored rules :root.sidebar-md &/:root.sidebar-sm & alongside &.sidebar-md/&.sidebar-sm, because at the moment of the first render the class only exists on <html>, not yet on .admin-layout (that's added later, by molique-script.js, to handle the click). The existing logic in molique-script.js stays unchanged - this fix is purely additive, reading what it already writes, just earlier.
  • Admin Header (Faux Cutout): .dashboard-header > left side + .dashboard-header-actions. Creates the illusion of a cutout in the header.
  • Admin Nav: .admin-nav > .admin-nav-link. Submenu: <details class="admin-nav-submenu"> > <summary class="admin-nav-link"> + .admin-nav-submenu-list (with .admin-nav-submenu-link). Native <details> - the same markup renders as a tree (wide sidebar), and on -sm/-md plus the mobile Bottom Nav as a full-screen drill-down with a "Back" bar. Active state is handled by the js/modules/molique-admin-nav.js module (auto-loaded): highlights the current item from the URL, and on desktop it OPENS the branch containing the current page itself (details.open = true), but closes it immediately on mobile (the drill-down never rides in open on its own). Mutually excludes open submenus (mobile only). Do NOT mark the active state with open in the markup - the module figures it out from the address, regardless of viewport.
  • Admin Nav - flat link activity: a sidebar without submenus (shared across several subpages) is handled by js/modules/molique-admin-nav-active.js (auto-loaded when .admin-nav is present): assigns .is-active to every .admin-nav-link pointing at the current URL, including its duplicate in the mobile bar. Skips links inside .admin-nav-submenu (those belong to molique-admin-nav.js). Do NOT write the active state into the markup - the script does it from the address.
  • Admin Nav - "More" drop-up (mobile): a SEPARATE pattern (Checkbox Hack) for overflow in the bar: <input type="checkbox" class="mobile-more-toggle"> + <label class="admin-nav-link mobile-more-label"> + .admin-nav-dropdown-menu (desktop display:contents, mobile a drawer from the bottom). There is NO .admin-nav-dropdown class on a <details>.
  • E-commerce:
    • Card: .product-card (add .product-list-view to the parent for a horizontal view - on the container SURROUNDING the cards, not on the card itself).
    • Product gallery: .product-gallery > .product-gallery-main (main photo, aspect-ratio: 1/1) + .product-gallery-thumbs > .gallery-thumb (a <button>, requires <img data-large="…"> - js/modules/molique-shop.js, auto-loaded when .product-gallery is present, takes the large photo from there on click). The module only wires up listeners, it does NOT set the initial state - mark the first thumbnail .is-active by hand, the rest .opacity-50. Placement variants: .product-gallery-left / -right - a thumbnail column beside the photo, ONLY from md up (below that: a default row underneath). DOM order stays fixed, -left only rearranges it visually via order.
    • Cart: .cart-item with a .qty-input controller > exactly two .qty-btns (JS uses :first-child/:last-child as minus/plus) + one .qty-val (type="number", requires min, optionally max).
    • Selection tiles: .selection-tile > a hidden input (not display:none) + .tile-content as a DIRECT sibling (:checked + .tile-content). The .selection-tile-animated variant works together with .hover-border-trace/-2 on .tile-content.
    • Stars: .star-rating (controlled via style="--rating: 4.5;", variables --star-size/--star-color/--star-bg).
    • Swatches: .product-swatches > .swatch (color via inline style="background-color:…", .is-active = a --primary outline).
  • Blog: .post-card (grid) + .post-date-badge (a date floating over the photo, requires .post-image-wrapper as a parent with position: relative). .blog-post (a classic list) + .post-date (a calendar column). NOTE: .post-date-badge and .post-date share the same child classes .day/.month, but with TWO different sets of styles - outside these two parents, .day/.month have no CSS at all. .simple-post-list (a sidebar widget) > .post-image + .post-info + .post-meta-date - styled ONLY in this context; thumbnail size via --post-thumb-size (defaults to 60px). .post-meta-date is NOT the same as .post-meta (a row of links with icons) - a similar name, zero shared code. .author-box > .author-avatar + .author-info (the parent for .author-name/.author-role/.author-bio).

Typography & Colors

  • Size scale: .text-1 through .text-12 (a fluid clamp()). The base text size (paragraph size) is .text-3. Below the base: .text-1 (12px) and .text-2 (13px) - metadata, timeline dates. Above it: .text-4-.text-8 match headings H5-H1, and .text-9-.text-12 are hero sizes (up to 9rem). Microcopy: .text-sm (11px) and .text-xs (10px) - even smaller than .text-1 (captions, legal fine print); .text-base returns to the base size.
  • Weights: .fw-light, .fw-normal, .fw-medium, .fw-bold, .fw-black.
  • Text/background colors: .text-primary, .bg-surface, .bg-body, .bg-glass (Glassmorphism).
  • Hover colors: .bg-hover-*, .text-hover-*, .border-hover-* (the full palette). NAMING SCHEME: WHAT-hover-COLOR - text-hover-primary, bg-hover-danger, border-hover-success. Never the other way around (hover-text-primary is a mistake; such classes were removed from the framework in 1.7.0). Do NOT add these to a .btn (a button has its own hover color from its variant, the rules would compete) - change --<color>-hover instead.
  • Button hover effects: the hover-* classes from the utilities module work on any element, including .btn. Safe ones: .hover-scale, .hover-shadow, .hover-gpu-shadow, .hover-tilt, .hover-border-draw, .hover-border-trace (the last two draw in their own ::before, they don't touch the background). The -2 variants (.hover-border-draw-2, .hover-border-trace-2) draw lines using gradients in the element's background-image: the button's background stays intact, but the line defaults to --primary, so it's invisible on .btn-primary - set --hover-border-color.
  • Icon lists: .list-unstyled and .list-icons + icon variant .list-icons-check/-arrow/-cross and color .list-icons-success/-danger/-dark.

Animations, Effects & Utilities (GPU)

  • Entrances: .animate.fade-in-up, .reveal-blur, .reveal-scale.
  • Scroll Reveal: .scroll-reveal (uses animation-timeline: view()).
  • Hover: .hover-spring, .hover-gpu-shadow, .hover-tilt (static) or .tilt-card (dynamic, JS). Lighter variants: .hover-scale, .hover-shadow.
  • Text Effects: .hover-text-wipe, .hover-underline, .text-highlight, .typewriter, .text-gradient-animated, .text-clip-bg.
  • Borders (Rounded): .hover-border-expand, .hover-border-spin.
  • Borders (Sharp): .hover-border-draw-2, .hover-border-trace-2.
  • Border Color: Change the default color by adding style="--hover-border-color: var(--danger);".
  • Background Video/Image: .bg-video-container > img.bg-video (poster) + video.bg-video; the static variant .bg-image-container > .bg-image (also picture.bg-image) - both with a default overlay.
  • Overlay (background darkening): parent .has-overlay + .overlay. .overlay alone already gives a 50% darkening - color (.overlay-dark/-primary/-light, .bg-overlay = black) and opacity (.overlay-10 through .overlay-90) only change it. .has-overlay is REQUIRED: without it the overlay looks for context further up and spills outside the section.
  • Sections: a bare <section> already has a default vertical rhythm (padding-block = 48px top and bottom). There is NO .section class - the spacing is a property of the tag itself. Don't add mb-5 pb-5; set your own spacing with a utility class (.py-4, .p-0), which overrides the default.
  • Separator: a bare <hr>, zero classes - full width, border-top: 1px solid var(--border-color), margin-block 16px. The reset is intentional: the browser's default <hr> has margin-inline: auto, which as a direct child of any flex container (e.g. .card-body) shrinks it to nearly nothing (cross-axis auto-margins beat align-items: stretch) - it looks like a dot. width: 100% + margin-inline: 0 eliminates this for good.
  • Image Filters: .filter-grayscale, .filter-blur, .filter-none (removes the filter, e.g. from .hover-filter-none).
  • Borders: .border, .border-0, .border-top, .border-bottom, .border-start, .border-end.
  • Rounding (Radius): .rounded-0 through .rounded-5, .rounded-circle, .rounded-pill, .rounded-top-0, .rounded-bottom-0.
  • Animated background blobs: .bg-blobs - two blurred, organic blobs (primary + info) floating in a container's background. The background follows the theme. The .bg-blobs-deep variant is ALWAYS DARK, even in light mode (like .navbar-pill) - white text works on it without checking the theme. Color via --blobs-deep-bg (defaults to #0F172A); do NOT use var(--bg-body) or var(--dark) there, since they invert in dark mode. Controlled via VARIABLES, not classes (color and speed are continuous values): --blob-1 / --blob-2 (blob colors), --blob-speed (the first one's cycle; the second computes its own as ×1.3, so a single value speeds up both while keeping their cycles offset). Typically used under .bg-glass (the glass needs something to blur). The shape is static (border-radius isn't animatable without reflow), motion comes only from a rotating transform. Turns off under prefers-reduced-motion.
  • Grid Expand (smooth accordion): .grid-expand > .grid-expand-inner (wraps the content; without it there's nothing for overflow:hidden to clip). Animates grid-template-rows: 0fr → 1fr. Three triggers: .is-open (manually, from JS), details[open] (a native <details>), .form-switch:has(.form-switch-input:checked) + .grid-expand (the switch must be a sibling RIGHT BEFORE it, not inside the same <label>). All zero-JS.
  • Other Helpers: .parallax-container (scroll-driven), .bg-gradient-corners (a glow), .stacking-container > .section-stacked, .embed-responsive (for YouTube/Vimeo video).

Widgets (Opt-in)

  • Carousels: .carousel > .carousel-track > .carousel-slide (width via its own min-width). Arrows are optional; dots .carousel-dots/.carousel-dot.is-active are generated by the script itself when there's more than 1 slide. The .carousel-bg-sync variant (+ .carousel-bg-overlay) changes the container's background to the visible slide's data-bg via the same IntersectionObserver; arrows are only visible on hover.
  • Lightbox: <a href="large.jpg" data-lightbox data-gallery="gallery"> - that's all you write. The script builds the whole modal itself (.lightbox-overlay/.lightbox-close/.lightbox-nav/…) at the end of <body> - don't write those classes by hand. Keyboard inside the open modal: ←/→ switches photos, Esc closes it, focus goes to .lightbox-close on open and returns to the trigger on close.
  • Portfolio Filters: .nav-filters (buttons with data-filter, "all" = everything) requires a .filter-item/data-category container as a direct nextElementSibling - nothing in between. The script assigns .is-hidden/.is-animated.
  • Reading Progress Bar: .progress-container-fixed > .progress-bar-reading, right after <body>. Handled permanently in the molique-script.js core, not in the autoloader.
  • Before / After: .before-after-slider > .img-after (the bottom layer, sets the height) + .img-before (clipped via clip-path based on --position) + .slider-control (an invisible input[range]) + .slider-line/.slider-handle. The two photos should share the same aspect ratio.
  • Magnetic Button: .btn-magnetic - zero CSS, the effect is an inline transform from JS on mousemove. Only (pointer: fine).
  • Speed Dial: .speed-dial (always bottom/right: 30px, no corner variant) > .speed-dial-main + .speed-dial-actions > .speed-dial-action. Expands on :hover/:focus-within - zero JS.
  • Sharing: .share-bar > .share-btn[data-network] (facebook/twitter/linkedin/whatsapp/native - native is the Web Share API, no support = a blocking alert()).
  • Back to Top: .scroll-to-top (also bottom/right: 30px - COLLIDES with .speed-dial on the same page) + .is-visible (added by the molique-script.js core after 400px of scroll).
  • Table Search: input[data-search-target="#id"] filters the #id rows live (an auto-loaded module). .cheat-sheet-category hides itself automatically when nothing beneath it matches.

Charts (Data Viz - Progressive Enhancement)

  • Principle: Charts are built as an HTML/CSS/SVG fallback.
  • Passing data: Values are passed from the backend ONLY through CSS variables: style="--val: 75%;".
  • Structure: .r-chart-wrapper (add .chart-micro for small charts) > .chart-sparkline / .chart-radial / .chart-heatmap / .chart-area / .chart-pie.
  • Funnels: .chart-funnel (vertical), .chart-pipeline (horizontal), .chart-funnel-true (classic trapezoid).
  • Chart Navigation (segmented range switcher): .chart-nav > <label class="chart-nav-item"> > <input type="radio" name="…"> + <span class="nav-label">. State is held by the radio, switching works without JS. The radio is hidden with the clip technique (NOT display: none), so the group stays operable with arrow keys; the focus ring lands on .nav-label.

3. JAVASCRIPT ARCHITECTURE

  • Autoloader: The main molique-script.js file scans the DOM and asynchronously fetches micro-modules from js/modules/ (e.g. carousel.js, lightbox.js) only when the matching component exists on the page.
  • Vanilla JS: jQuery is completely forbidden.
  • File names always carry the molique- prefix - applies to everything that ends up in someone else's project: the core (molique-script.js), JS modules (js/modules/molique-*.js), CSS bundles (css/molique-style*.css), and configurator chunks (dist/chunks/molique-*.css). This lets sync scripts overwrite only the framework's own files. The chunk name is assigned by tools/gen-chunks.js and written into the manifest - the configurator reads it from there.
  • NEVER concatenate class names dynamically ('toast-' + type, `col-span-${n}`) - such a name doesn't exist as a literal in the source, so neither PurgeCSS nor the safelist generator can see it. Use a literal map instead: const T = { success: 'toast-success', … } + T[type] || T.info.
  • States always as .is-* (is-active, is-hidden, is-selected) - the convention the safelist pattern relies on.

4. PURGE / CSS SIZE

  • Modules first, purge second: choosing bundles (admin, shop, blog…) is a risk-free reduction; PurgeCSS comes only after that.
  • Safelist: the package includes purgecss.safelist.cjs. safelist: molique.runtime = the minimum (classes added by JS). molique.merge('status','grid') when the backend concatenates class names (e.g. badge-<?= $status ?>). Without the safelist you lose, among others, .is-*, toast-*, lightbox-*, @keyframes toastProgressAnim.
  • Never variables: true - the whole theme rests on CSS variables. Effect on a real page: 277 KB → 68 KB (−75%).