# CSS & JavaScript Conventions ## CSS ### Tailwind First Use Tailwind CSS as the primary styling method. Only use custom CSS when Tailwind is insufficient. ```html

Title

``` ### BEM for Custom CSS When custom CSS is needed, scope everything under a root class using BEM naming: ```css /* Root class in kebab-case */ .hero-section { } .hero-section__title { } .hero-section__image { } .hero-section--dark { } ``` Never use global classes without a module prefix. ### CSS Variables Acai provides theme variables: ```css var(--main-color) /* Primary brand color */ var(--main-color-light) /* Lighter variant */ var(--main-color-dark) /* Darker variant */ ``` ### Utility Classes (Built-in) | Class | Description | |-------|-------------| | `transition3s` | 0.3s smooth transition | | `click-a-child` | Makes parent clickable via child `` tag | | `line-clamp2` / `line-clamp3` / `line-clamp5` | Text truncation with ellipsis | | `filter-white` | CSS filter to make images/icons white | | `lazyload` | Lazy loading (use with `data-src`) | ## JavaScript ### Module Scripts (`script.js`) Keep JavaScript scoped to the module. Use `section_id` for targeting: ```js // Scope to this module instance const section = document.getElementById('{{ section_id }}'); if (section) { const buttons = section.querySelectorAll('.btn'); // ... } ``` ### CmsApi (Client-Side) ```js // Call a hook CmsApi.hook('/hooks/module_id/', { action: 'getData', id: 123 }, function(response) { console.log(response); }); ``` ### Vue 3 Integration For complex interactivity, use Vue 3 via CDN with Composition API: ```html

${ message }

``` **Important:** Use `'${'` and `'}'` as Vue delimiters to avoid conflicts with Twig's `{{ }}` syntax.