# Callout Shortcode Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Add a `{{< callout >}}` Hugo shortcode with 6 semantic types (note, tip, info, warning, danger, success), CSS-only styling, full i18n (EN/IT), and WCAG AA compliance. **Architecture:** Single shortcode template (`callout.html`) emits semantic HTML with type-derived CSS classes. All visual styling lives in `main.css` via CSS custom properties — no inline styles or Hugo logic in the template. Colors reuse existing theme tokens (`--accent`, `--accent2`, `--type-link`, `--type-life`); only `--callout-danger` is a hardcoded exception (red, approved). **Tech Stack:** Hugo templating, Tailwind CSS (`@apply`), CSS custom properties, Feather Icons (already loaded site-wide), i18n YAML. --- ## File Map | File | Action | Responsibility | |------|--------|---------------| | `themes/danix-xyz-hacker/assets/css/main.css` | **Modify (Task 0)** | Fix drifted `html.theme-light` vars to match THEMING-STANDARD | | `themes/danix-xyz-hacker/layouts/shortcodes/callout.html` | **Create** | Shortcode template — HTML structure, ARIA, icon+title, markdown body | | `themes/danix-xyz-hacker/assets/css/main.css` | **Modify (Tasks 1–2)** | `--callout-*` CSS vars in `:root` + `html.theme-light`; `.callout` + `.callout-*` component classes | | `themes/danix-xyz-hacker/assets/css/main.min.css` | **Rebuild** | Compiled output — regenerated via `npm run build` | | `themes/danix-xyz-hacker/i18n/en.yaml` | **Modify** | 6 English callout title keys | | `themes/danix-xyz-hacker/i18n/it.yaml` | **Modify** | 6 Italian callout title keys | | `i18n/en.yaml` | **Modify** | Mirror keys (content repo overrides theme i18n) | | `i18n/it.yaml` | **Modify** | Mirror keys (content repo overrides theme i18n) | | `SHORTCODES.md` | **Modify** | Document callout shortcode before "Future Shortcodes" section | --- ## Task 0: Fix drifted `html.theme-light` vars in `main.css` **Files:** - Modify: `themes/danix-xyz-hacker/assets/css/main.css` (lines 35–62, `html.theme-light` block) The current `html.theme-light` block has values that differ from THEMING-STANDARD.md. This task corrects the drift before any callout work builds on top. **Current vs correct values:** | Variable | Current in main.css | THEMING-STANDARD correct value | |----------|--------------------|---------------------------------| | `--bg` | `#ffffff` | `#f0f4f8` | | `--bg2` | `#f8f9fa` | `#e2eaf4` | | `--bg2-rgb` | `248, 249, 250` | `232, 234, 244` | | `--surface` | `#f0f3f7` | `#d4dff0` | | `--surface-rgb` | `240, 243, 247` | `212, 223, 240` | | `--border` | `#d9dfe8` | `#a8bdd8` | | `--accent` | `#9333ea` | `#7c3aed` | | `--accent-rgb` | `147, 51, 234` | `124, 58, 237` | | `--accent2` | `#10b981` | `#008f5a` | | `--accent-glow` | `rgba(147, 51, 234, 0.1)` | `rgba(124, 58, 237, 0.1)` | | `--text` | `#1f2937` | `#0d1b2a` | | `--text-dim` | `#374151` | `#2e4a6a` | | `--muted` | `#d1d5db` | `#6888a8` | | `--type-tech` | `#7c3aed` | `#7c3aed` ✓ same | | `--type-life` | `#d97706` | `#d97706` ✓ same | | `--type-quote` | `#008f5a` | `#008f5a` ✓ same | | `--type-link` | `#0284c7` | `#0284c7` ✓ same | | `--type-photo` | `#be185d` | `#be185d` ✓ same | - [ ] **Step 1: Replace the entire `html.theme-light` block** Find and replace the `html.theme-light { ... }` block (lines 35–62) with: ```css /* Light theme overrides */ html.theme-light { --bg: #f0f4f8; --bg2: #e2eaf4; --bg2-rgb: 232, 234, 244; --surface: #d4dff0; --surface-rgb: 212, 223, 240; --border: #a8bdd8; --accent: #7c3aed; --accent-rgb: 124, 58, 237; --accent2: #008f5a; --accent-glow: rgba(124, 58, 237, 0.1); --text: #0d1b2a; --text-dim: #2e4a6a; --muted: #6888a8; /* Article type colors - light */ --type-tech: #7c3aed; --type-life: #d97706; --type-quote: #008f5a; --type-link: #0284c7; --type-photo: #be185d; /* Article type text colors - light (mixed for WCAG AA) */ --type-tech-text: #ffffff; --type-life-text: #000000; --type-quote-text: #000000; --type-link-text: #000000; --type-photo-text: #ffffff; } ``` Also find the `@media (prefers-color-scheme: light)` block (lines ~64–91) and apply the same value corrections there — it mirrors `html.theme-light` for the no-JS fallback. - [ ] **Step 2: Rebuild CSS and do a visual check** ```bash npm run build hugo server ``` Open the site and toggle light mode. Confirm: background is now a slightly blue-tinted off-white (`#f0f4f8`) rather than pure white. Text is darker navy (`#0d1b2a`). No layout breakage. - [ ] **Step 3: Commit the fix** ```bash cd /home/danix/Programming/GIT/danix2-hugo-theme git add assets/css/main.css git commit -m "fix: align html.theme-light CSS vars with THEMING-STANDARD.md" git push origin master ``` --- ## Task 1: Add CSS variables to `main.css` **Files:** - Modify: `themes/danix-xyz-hacker/assets/css/main.css` (lines 6–34 `:root` block, lines 35–62 `html.theme-light` block) - [ ] **Step 1: Add `--callout-*` vars to `:root` block** In `themes/danix-xyz-hacker/assets/css/main.css`, find the `:root` block. After the `--type-photo-text: #000000;` line (line 31), add: ```css /* Callout shortcode colors */ --callout-note: var(--accent); --callout-tip: var(--accent2); --callout-info: var(--type-link); --callout-warning: var(--type-life); --callout-danger: #ef4444; --callout-success: var(--accent2); ``` - [ ] **Step 2: Add `--callout-danger` override to `html.theme-light` block** In `html.theme-light` (lines 35–62), after `--type-photo-text: #ffffff;` (line 61), add: ```css /* Callout shortcode colors */ --callout-danger: #ef4444; ``` Note: all other `--callout-*` vars resolve automatically via `--accent`, `--accent2`, `--type-link`, `--type-life` which already have light overrides. Only danger needs explicit repeat since it's hardcoded. - [ ] **Step 3: Verify vars resolve correctly in both themes** Run `hugo server` and in browser devtools inspect `:root` computed styles — confirm `--callout-note` resolves to `#a855f7` in dark and `#9333ea` in light. --- ## Task 2: Add `.callout` component CSS **Files:** - Modify: `themes/danix-xyz-hacker/assets/css/main.css` (after toast block, ~line 1724) - [ ] **Step 1: Add callout component block at end of file, before the `prefers-reduced-motion` block** Find the `/* Motion Safety */` comment (line ~1708). Insert the following block immediately before it: ```css /* ============================================================ Callout Shortcode ============================================================ */ .callout { @apply relative my-6 py-3 px-4 rounded-r-md; } .callout::after { content: ''; position: absolute; bottom: 0; left: 0; width: 50%; height: 1px; background: linear-gradient(to right, var(--callout-color), transparent); } .callout-title { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.375rem; } .callout-title span { font-family: var(--font-mono, 'JetBrains Mono', monospace); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--callout-color); } .callout-title svg, .callout-title i { width: 14px; height: 14px; color: var(--callout-color); flex-shrink: 0; } .callout-body { color: var(--text); font-size: 0.875rem; line-height: 1.6; } .callout-body p:last-child { margin-bottom: 0; } /* Type variants — sets --callout-color for border, title, icon, and ::after gradient */ .callout-note { --callout-color: var(--callout-note); border-left: 4px solid var(--callout-note); background: rgba(168, 85, 247, 0.08); } .callout-tip { --callout-color: var(--callout-tip); border-left: 4px solid var(--callout-tip); background: rgba(0, 255, 136, 0.08); } .callout-info { --callout-color: var(--callout-info); border-left: 4px solid var(--callout-info); background: rgba(56, 189, 248, 0.08); } .callout-warning { --callout-color: var(--callout-warning); border-left: 4px solid var(--callout-warning); background: rgba(245, 158, 11, 0.08); } .callout-danger { --callout-color: var(--callout-danger); border-left: 4px solid var(--callout-danger); background: rgba(239, 68, 68, 0.08); } .callout-success { --callout-color: var(--callout-success); border-left: 4px solid var(--callout-success); background: rgba(0, 255, 136, 0.08); } /* Light mode — reduce opacity to 0.06 per theming standard rgba values derived from THEMING-STANDARD.md corrected vars: --accent #7c3aed, --accent2 #008f5a, --type-link #0284c7, --type-life #d97706 */ html.theme-light .callout-note { background: rgba(124, 58, 237, 0.06); } /* #7c3aed */ html.theme-light .callout-tip { background: rgba(0, 143, 90, 0.06); } /* #008f5a */ html.theme-light .callout-info { background: rgba(2, 132, 199, 0.06); } /* #0284c7 */ html.theme-light .callout-warning { background: rgba(217, 119, 6, 0.06); } /* #d97706 */ html.theme-light .callout-danger { background: rgba(239, 68, 68, 0.06); } /* #ef4444 */ html.theme-light .callout-success { background: rgba(0, 143, 90, 0.06); } /* #008f5a */ ``` - [ ] **Step 2: Rebuild CSS** ```bash npm run build ``` Expected: no errors, `themes/danix-xyz-hacker/assets/css/main.min.css` updated. - [ ] **Step 3: Verify `.callout-*` classes in compiled output** ```bash grep -c "callout" themes/danix-xyz-hacker/assets/css/main.min.css ``` Expected: number > 0 (classes present in output). --- ## Task 3: Create the shortcode template **Files:** - Create: `themes/danix-xyz-hacker/layouts/shortcodes/callout.html` - [ ] **Step 1: Create `callout.html`** ```html {{- $type := .Get "type" | default "note" -}} {{- $title := .Get "title" | default (i18n (printf "callout_%s" $type)) -}} {{- $role := cond (eq $type "danger") "alert" "note" -}} {{- $icons := dict "note" "edit-2" "tip" "zap" "info" "info" "warning" "alert-triangle" "danger" "x-circle" "success" "check-circle" -}} {{- $icon := index $icons $type | default "info" -}}