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.
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
@layercascade layers. No!importantallowed (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-actionbuttons in dense tables. - GPU performance: Animations may only modify
transform,scale,translate, andopacity. Never animatebox-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-1through12. Children.col-span-1through12. The.grid-md-cols-*and.grid-lg-cols-*variants are single-column by DEFAULT below their own breakpoint, soclass="grid-md-cols-12"is enough - addinggrid-cols-1changes 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-12on mobile will break the layout. - Offsets (Grid):
.col-start-1through12OR the classic.offset-1through11(plus-md-,-lg-variants). Lets you shift elements within the grid. - Flexbox:
.d-flex,.flex-column,.align-items-center,.justify-content-between,.gap-1through.gap-5. Single child:.align-self-start/-end/-center/-stretch. - Spacing:
.m-1through.m-5,.p-1through.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-activeclass on.navbar-item(and.dropdown-item/.mega-menu-link) - primary color + heavier weight. Assigned from the URL by thejs/modules/molique-navbar-active.jsmodule (auto-loaded when.navbar-menuis 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 byvar(--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 viastyle="--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-colorover the hero,--navbar-pill-bg-scrolled/--navbar-pill-color-scrolledafter 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-groupwith.mega-menu-col-titleand.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.namemakes 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-menuwith apopoverattribute and a uniqueid- the menu is NOT clipped by overflow (tables, cards, modals) and anchors itself automatically to its button (implicit anchor, no.dropdownwrapper 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-thumband.theme-icon-wrapper>.theme-icon.icon-sun/.theme-icon.icon-moon).id="theme-toggle"is REQUIRED -molique-script.jslooks it up viagetElementById; a differentidor a second switch on the page = silent failure, no error. The choice lives inlocalStorageundermolique-theme; on first visit it readsprefers-color-scheme; the theme is thedata-themeattribute 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-menuwith apopoverattribute andid>.dropdown-item.language-switch-item(with.language-switch-flag,.language-switch-name, optionally.language-switch-check). Flags ONLY as separate SVG files fromimg/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 forclass="btn btn-primary"; add plain.btnonly for a colorless button. The implication only covers colors and their outline variants - size and base-look modifiers do NOT carry it, and.btn-actiondeliberately 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/-glowclass on<body>(buttons with their ownhover-*class take priority). - Buttons - look variants:
.btn-3d(requires--btn-3d-shadowin 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-contextfor a side/bottom panel). Closing:<form method="dialog">. - Tabs:
.tabs> hiddeninput.tab-input[type=radio](sharedname) +.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-pillvariant with.tabs-pill-indicator(width computed from--tab-count)..tab-inputis hidden with thecliptechnique (like.sr-only, NOTdisplay: 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 withgap; the::afterarrow is pushed bymargin-left: auto- several elements (e.g. a.badgeplus text) stay left-aligned. Wrap a sentence containing<code>in a single<span>, otherwisegapwill 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-cardsto<table>. Requires adata-label="Name"attribute on every<td>- CSS reads labels ONLY from there, it won't read them from<th>. The.table-cards-alwaysvariant 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-titleand.row-details) +.row-actions. - Pricing Tables:
.pricing-table(add.is-featuredto highlight one) >.pricing-header+.pricing-features. - Progress Bars:
.progress>.progress-bar(width viastyle="width: X%"). NOTE:.progress-bar/.progress-bar-readinganimatewidth(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-nodeand.timeline-line) +.timeline-content. - Stepper:
.stepper(variant:.stepper-numbered) >.step(add.is-activeor.is-completed).
Forms (Zero JS Validation)
- Floating Labels:
.form-floating>input.input[placeholder=" "]+label+.feedback-invalid. Its ownmargin-bottomzeroes out as a direct child of.card-body(which has a gap) - outside.card-bodyit 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-inputwith+/-buttons, the keyboard, and scroll). - Searchable Select (Popover API):
.select-search><button class="input select-search-trigger" popovertarget="ID">+.select-search-menuwith apopoverattribute and a uniqueid(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.jsuses event delegation (handles options added after page load, e.g. via AJAX); the hidden input gets achangeevent on selection; set the value from JS withMoliqueSelectSearch.setValue(hiddenInput, value). - Premium Multi Select (Popover API):
.custom-select><button class="custom-select-trigger" popovertarget="ID">+.custom-select-dropdownwith apopoverattribute and a uniqueid(with.custom-select-categoryand.custom-select-option). - File Upload:
.file-upload(variant:.file-upload-animated) > an invisibleinput[type="file"]stretched over the whole zone (click and drag&drop work natively). The auto-loadedjs/modules/molique-file-upload.jslistens forchangeand overwrites.file-upload-namewith 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' }).messageis TEXT (since v1.7.37 it goes in throughtextContent, markup shows literally) - HTML only on purpose withhtml: 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-pingfor a pulsing effect. - Stock Bar (segmented stock level):
.stock-bar+ variant.stock-bar-success/-warning/-danger(no variant: secondary color). Filled from the backend viastyle="--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 addrole="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-floatingvariant 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-sidebarand.admin-mainthe 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-iconwith exactly three empty<span>s (morphing hamburger → asymmetric lines → arrow). A click cycles.admin-layoutbetween full /.sidebar-md/.sidebar-sm, remembered inlocalStorage(molique-sidebar-state). The logic lives permanently in themolique-script.jscore, 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-statefromlocalStorageare only read onDOMContentLoadedinmolique-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 setsdata-theme+ thesidebar-md/sidebar-smclass on<html>BEFORE the first paint; (2)layout/_admin-layout.scssgets 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, bymolique-script.js, to handle the click). The existing logic inmolique-script.jsstays 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/-mdplus the mobile Bottom Nav as a full-screen drill-down with a "Back" bar. Active state is handled by thejs/modules/molique-admin-nav.jsmodule (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 withopenin 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-navis present): assigns.is-activeto every.admin-nav-linkpointing at the current URL, including its duplicate in the mobile bar. Skips links inside.admin-nav-submenu(those belong tomolique-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(desktopdisplay:contents, mobile a drawer from the bottom). There is NO.admin-nav-dropdownclass on a<details>. - E-commerce:
- Card:
.product-card(add.product-list-viewto 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-galleryis 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-activeby hand, the rest.opacity-50. Placement variants:.product-gallery-left/-right- a thumbnail column beside the photo, ONLY frommdup (below that: a default row underneath). DOM order stays fixed,-leftonly rearranges it visually viaorder. - Cart:
.cart-itemwith a.qty-inputcontroller > exactly two.qty-btns (JS uses:first-child/:last-childas minus/plus) + one.qty-val(type="number", requiresmin, optionallymax). - Selection tiles:
.selection-tile> a hidden input (notdisplay:none) +.tile-contentas a DIRECT sibling (:checked + .tile-content). The.selection-tile-animatedvariant works together with.hover-border-trace/-2on.tile-content. - Stars:
.star-rating(controlled viastyle="--rating: 4.5;", variables--star-size/--star-color/--star-bg). - Swatches:
.product-swatches>.swatch(color via inlinestyle="background-color:…",.is-active= a--primaryoutline).
- Card:
- Blog:
.post-card(grid) +.post-date-badge(a date floating over the photo, requires.post-image-wrapperas a parent withposition: relative)..blog-post(a classic list) +.post-date(a calendar column). NOTE:.post-date-badgeand.post-dateshare the same child classes.day/.month, but with TWO different sets of styles - outside these two parents,.day/.monthhave 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-dateis 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-1through.text-12(a fluidclamp()). 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-8match headings H5-H1, and.text-9-.text-12are hero sizes (up to 9rem). Microcopy:.text-sm(11px) and.text-xs(10px) - even smaller than.text-1(captions, legal fine print);.text-basereturns 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-primaryis 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>-hoverinstead. - 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-2variants (.hover-border-draw-2,.hover-border-trace-2) draw lines using gradients in the element'sbackground-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-unstyledand.list-icons+ icon variant.list-icons-check/-arrow/-crossand color.list-icons-success/-danger/-dark.
Animations, Effects & Utilities (GPU)
- Entrances:
.animate.fade-in-up,.reveal-blur,.reveal-scale. - Scroll Reveal:
.scroll-reveal(usesanimation-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(alsopicture.bg-image) - both with a default overlay. - Overlay (background darkening): parent
.has-overlay+.overlay..overlayalone already gives a 50% darkening - color (.overlay-dark/-primary/-light,.bg-overlay= black) and opacity (.overlay-10through.overlay-90) only change it..has-overlayis 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.sectionclass - the spacing is a property of the tag itself. Don't addmb-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-block16px. The reset is intentional: the browser's default<hr>hasmargin-inline: auto, which as a direct child of any flex container (e.g..card-body) shrinks it to nearly nothing (cross-axis auto-margins beatalign-items: stretch) - it looks like a dot.width: 100%+margin-inline: 0eliminates 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-0through.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-deepvariant 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 usevar(--bg-body)orvar(--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-radiusisn't animatable without reflow), motion comes only from a rotatingtransform. Turns off underprefers-reduced-motion. - Grid Expand (smooth accordion):
.grid-expand>.grid-expand-inner(wraps the content; without it there's nothing foroverflow:hiddento clip). Animatesgrid-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 ownmin-width). Arrows are optional; dots.carousel-dots/.carousel-dot.is-activeare generated by the script itself when there's more than 1 slide. The.carousel-bg-syncvariant (+.carousel-bg-overlay) changes the container's background to the visible slide'sdata-bgvia the sameIntersectionObserver; 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,Esccloses it, focus goes to.lightbox-closeon open and returns to the trigger on close. - Portfolio Filters:
.nav-filters(buttons withdata-filter,"all"= everything) requires a.filter-item/data-categorycontainer as a directnextElementSibling- 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 themolique-script.jscore, not in the autoloader. - Before / After:
.before-after-slider>.img-after(the bottom layer, sets the height) +.img-before(clipped viaclip-pathbased on--position) +.slider-control(an invisibleinput[range]) +.slider-line/.slider-handle. The two photos should share the same aspect ratio. - Magnetic Button:
.btn-magnetic- zero CSS, the effect is an inlinetransformfrom JS onmousemove. Only(pointer: fine). - Speed Dial:
.speed-dial(alwaysbottom/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 blockingalert()). - Back to Top:
.scroll-to-top(alsobottom/right: 30px- COLLIDES with.speed-dialon 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#idrows live (an auto-loaded module)..cheat-sheet-categoryhides 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-microfor 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 thecliptechnique (NOTdisplay: none), so the group stays operable with arrow keys; the focus ring lands on.nav-label.
3. JAVASCRIPT ARCHITECTURE
- Autoloader: The main
molique-script.jsfile scans the DOM and asynchronously fetches micro-modules fromjs/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 bytools/gen-chunks.jsand 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%).