prima bozza sito sindacato

This commit is contained in:
vecna 2026-04-20 18:33:22 +02:00
commit 59ef4db64f
31 changed files with 1576 additions and 0 deletions

504
assets/css/main.css Normal file
View file

@ -0,0 +1,504 @@
/* ==========================================================================
COLOR SYSTEM edit these to change the entire palette
========================================================================== */
:root {
--color-bg: #0a0a0a;
--color-text: #e8e4df;
--color-text-muted: #8a8580;
--color-accent: #c4a35a; /* placeholder — define later */
--color-accent-hover: #d4b76a; /* placeholder — define later */
--color-border: #2a2725;
--color-surface: #141210;
--color-footnote-bg: #1a1816;
}
/* ==========================================================================
RESET & BASE
========================================================================== */
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 18px;
scroll-behavior: smooth;
}
body {
font-family: 'EB Garamond', 'Garamond', 'Georgia', serif;
background-color: var(--color-bg);
color: var(--color-text);
line-height: 1.72;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* ==========================================================================
TYPOGRAPHY
========================================================================== */
h1 {
font-family: 'EB Garamond', 'Garamond', serif;
font-weight: 700;
font-size: 2.8rem;
line-height: 1.15;
margin-bottom: 0.6em;
letter-spacing: -0.01em;
color: var(--color-text);
}
h2 {
font-family: 'EB Garamond', 'Garamond', serif;
font-weight: 400;
font-style: italic;
font-size: 1.8rem;
line-height: 1.3;
margin-top: 1.8em;
margin-bottom: 0.5em;
color: var(--color-text);
}
h3 {
font-family: 'EB Garamond', 'Garamond', serif;
font-weight: 400;
font-size: 1.25rem;
line-height: 1.4;
text-transform: uppercase;
letter-spacing: 0.08em;
margin-top: 1.8em;
margin-bottom: 0.5em;
color: var(--color-text);
}
h4 {
font-family: 'EB Garamond', 'Garamond', serif;
font-weight: 400;
font-style: italic;
font-size: 1.25rem;
line-height: 1.4;
margin-top: 1.5em;
margin-bottom: 0.4em;
color: var(--color-text);
}
p {
margin-bottom: 1.2em;
}
a {
color: var(--color-accent);
text-decoration: none;
transition: color 0.2s ease;
}
a:hover {
color: var(--color-accent-hover);
}
blockquote {
border-left: 2px solid var(--color-accent);
padding-left: 1.2em;
margin: 1.5em 0;
font-style: italic;
color: var(--color-text-muted);
}
ul, ol {
margin-bottom: 1.2em;
padding-left: 1.4em;
}
li {
margin-bottom: 0.3em;
}
hr {
border: none;
border-top: 1px solid var(--color-border);
margin: 2.5em 0;
}
strong {
font-weight: 700;
}
em {
font-style: italic;
}
code {
font-size: 0.88em;
background: var(--color-surface);
padding: 0.15em 0.4em;
border-radius: 3px;
}
/* ==========================================================================
HEADER
========================================================================== */
.site-header {
border-bottom: 1px solid var(--color-border);
}
.site-nav {
max-width: 1200px;
margin: 0 auto;
padding: 1.4rem 2rem;
display: flex;
justify-content: space-between;
align-items: baseline;
}
.nav-main {
display: flex;
gap: 2.5rem;
align-items: baseline;
}
.nav-link {
font-size: 1rem;
color: var(--color-text-muted);
text-transform: uppercase;
letter-spacing: 0.1em;
font-weight: 400;
transition: color 0.2s ease;
}
.nav-link:hover {
color: var(--color-text);
}
.nav-home {
font-weight: 600;
color: var(--color-text);
letter-spacing: 0.12em;
}
.nav-lang {
display: flex;
gap: 0.8rem;
}
.lang-link {
font-size: 0.78rem;
color: var(--color-text-muted);
letter-spacing: 0.08em;
text-transform: uppercase;
}
.lang-link:hover {
color: var(--color-text);
}
.lang-active {
color: var(--color-accent);
}
/* ==========================================================================
FOOTER
========================================================================== */
.site-footer {
border-top: 1px solid var(--color-border);
margin-top: 4rem;
}
.footer-inner {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
font-size: 0.85rem;
color: var(--color-text-muted);
}
/* ==========================================================================
CONTENT LAYOUT SIDENOTES (3/4 + 1/4)
========================================================================== */
.page-content {
max-width: 1200px;
margin: 0 auto;
padding: 3rem 2rem;
}
.sidenote-layout .content-body {
position: relative;
width: 72%;
}
.page-date {
display: block;
font-size: 0.9rem;
color: var(--color-text-muted);
margin-bottom: 2em;
font-style: italic;
}
/* ==========================================================================
SIDENOTES footnotes repositioned to the margin
========================================================================== */
/* The original footnote section rendered by Hugo at the bottom */
.sidenote-layout .footnotes {
display: none; /* hidden once JS has promoted notes to the margin */
}
/* Each sidenote placed by JS */
.sidenote {
position: absolute;
right: -36%; /* push into the right margin */
width: 28%; /* ~1/4 of the total page width */
font-size: 0.82rem;
line-height: 1.55;
color: var(--color-text-muted);
padding-left: 1.2rem;
border-left: 1px solid var(--color-border);
}
.sidenote-number {
font-size: 0.72rem;
font-weight: 600;
color: var(--color-accent);
margin-right: 0.3em;
vertical-align: super;
}
/* Inline footnote reference numbers */
.sidenote-layout .content-body sup a,
.sidenote-layout .content-body a[href^="#fn:"],
.sidenote-layout .content-body sup a[href^="#fn"] {
color: var(--color-accent);
font-weight: 600;
text-decoration: none;
font-size: 0.72em;
}
.sidenote-layout .content-body sup a:hover,
.sidenote-layout .content-body a[href^="#fn:"]:hover {
color: var(--color-accent-hover);
}
/* Fallback: if JS has not run, show footnotes normally */
.sidenotes-fallback .footnotes {
display: block;
margin-top: 3rem;
padding-top: 1.5rem;
border-top: 1px solid var(--color-border);
font-size: 0.88rem;
color: var(--color-text-muted);
}
/* ==========================================================================
INITIATIVE LIST (section page)
========================================================================== */
.initiative-list {
margin-top: 2.5rem;
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.initiative-card {
display: block;
padding: 1.5rem;
border: 1px solid var(--color-border);
background: var(--color-surface);
transition: border-color 0.25s ease, background-color 0.25s ease;
text-decoration: none;
}
.initiative-card:hover {
border-color: var(--color-accent);
background: var(--color-footnote-bg);
}
.initiative-card h3 {
margin-top: 0;
margin-bottom: 0.3em;
color: var(--color-text);
}
.initiative-subtitle {
font-style: italic;
color: var(--color-text-muted);
margin-bottom: 0.5em;
font-size: 1.05rem;
}
.initiative-summary {
color: var(--color-text-muted);
font-size: 0.95rem;
}
/* ==========================================================================
CSV TABLES (shortcode)
========================================================================== */
.csv-table {
margin: 1.5rem 0 2rem 0;
padding: 1rem;
border: 1px solid var(--color-border);
background: var(--color-surface);
--csv-max-rows: 4;
--csv-row-height: 2.2rem;
--csv-header-height: 2.4rem;
}
.csv-table__header {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 1rem;
flex-wrap: wrap;
margin-bottom: 0.8rem;
}
.csv-table__title {
margin: 0;
font-size: 1rem;
letter-spacing: 0.03em;
text-transform: uppercase;
}
.csv-table__meta {
display: inline-flex;
align-items: center;
gap: 0.85rem;
flex-wrap: wrap;
}
.csv-table__count {
font-size: 0.84rem;
color: var(--color-text-muted);
}
.csv-table__download {
display: inline-block;
font-size: 0.84rem;
border: 1px solid var(--color-border);
padding: 0.2rem 0.6rem;
text-transform: uppercase;
letter-spacing: 0.06em;
}
.csv-table__viewport {
max-width: 100%;
max-height: calc((var(--csv-row-height) * var(--csv-max-rows)) + var(--csv-header-height));
overflow: auto;
border: 1px solid var(--color-border);
}
.csv-table__status {
margin: 0;
padding: 0.7rem 0.8rem;
color: var(--color-text-muted);
font-size: 0.92rem;
}
.csv-table__table {
border-collapse: collapse;
width: max-content;
min-width: 100%;
font-size: 0.86rem;
}
.csv-table__table th,
.csv-table__table td {
border: 1px solid var(--color-border);
padding: 0.45rem 0.55rem;
text-align: left;
white-space: nowrap;
vertical-align: top;
}
.csv-table__table thead th {
position: sticky;
top: 0;
z-index: 1;
background: var(--color-footnote-bg);
}
.csv-table__table tbody tr {
height: var(--csv-row-height);
}
/* ==========================================================================
RESPONSIVE
========================================================================== */
@media (max-width: 900px) {
html {
font-size: 17px;
}
.sidenote-layout .content-body {
width: 100%;
}
/* On small screens sidenotes become inline blocks below the paragraph */
.sidenote {
position: relative;
right: auto;
width: 100%;
margin: 0.8em 0 1.2em 0;
padding: 0.8em 1em;
background: var(--color-footnote-bg);
border-left: 2px solid var(--color-accent);
border-radius: 0;
}
.site-nav {
padding: 1rem 1.2rem;
flex-direction: column;
gap: 0.6rem;
}
.nav-main {
gap: 1.5rem;
}
h1 {
font-size: 2rem;
}
h2 {
font-size: 1.4rem;
}
.csv-table {
padding: 0.8rem;
}
.csv-table__table {
font-size: 0.8rem;
}
}
@media (max-width: 600px) {
html {
font-size: 16px;
}
.page-content {
padding: 2rem 1rem;
}
h1 {
font-size: 1.7rem;
}
}

153
assets/js/csv-tables.js Normal file
View file

@ -0,0 +1,153 @@
(function () {
'use strict';
function parseCsv(text) {
var rows = [];
var row = [];
var field = '';
var i = 0;
var inQuotes = false;
while (i < text.length) {
var ch = text[i];
if (inQuotes) {
if (ch === '"') {
if (text[i + 1] === '"') {
field += '"';
i += 2;
continue;
}
inQuotes = false;
i += 1;
continue;
}
field += ch;
i += 1;
continue;
}
if (ch === '"') {
inQuotes = true;
i += 1;
continue;
}
if (ch === ',') {
row.push(field);
field = '';
i += 1;
continue;
}
if (ch === '\n') {
row.push(field);
rows.push(row);
row = [];
field = '';
i += 1;
continue;
}
if (ch === '\r') {
i += 1;
continue;
}
field += ch;
i += 1;
}
if (field.length > 0 || row.length > 0) {
row.push(field);
rows.push(row);
}
return rows.filter(function (r) {
return r.length > 1 || (r.length === 1 && r[0].trim() !== '');
});
}
function buildTable(headers, dataRows) {
var table = document.createElement('table');
table.className = 'csv-table__table';
var thead = document.createElement('thead');
var headRow = document.createElement('tr');
headers.forEach(function (h) {
var th = document.createElement('th');
th.textContent = h;
headRow.appendChild(th);
});
thead.appendChild(headRow);
table.appendChild(thead);
var tbody = document.createElement('tbody');
dataRows.forEach(function (r) {
var tr = document.createElement('tr');
headers.forEach(function (_, idx) {
var td = document.createElement('td');
td.textContent = r[idx] !== undefined ? r[idx] : '';
tr.appendChild(td);
});
tbody.appendChild(tr);
});
table.appendChild(tbody);
return table;
}
function renderCsvTable(container) {
var src = container.getAttribute('data-src');
var countEl = container.querySelector('[data-csv-count]');
var statusEl = container.querySelector('[data-csv-status]');
var viewport = container.querySelector('[data-csv-viewport]');
if (!src || !viewport || !statusEl || !countEl) {
return;
}
fetch(src)
.then(function (response) {
if (!response.ok) {
throw new Error('HTTP ' + response.status);
}
return response.text();
})
.then(function (csvText) {
var rows = parseCsv(csvText);
if (rows.length === 0) {
statusEl.textContent = 'CSV vuoto.';
countEl.textContent = 'Righe: 0';
return;
}
var headers = rows[0];
var dataRows = rows.slice(1);
var table = buildTable(headers, dataRows);
viewport.innerHTML = '';
viewport.appendChild(table);
countEl.textContent = 'Righe: ' + dataRows.length;
})
.catch(function (error) {
statusEl.textContent = 'Impossibile caricare il CSV (' + error.message + ').';
countEl.textContent = 'Righe: n/d';
});
}
function initCsvTables() {
var containers = document.querySelectorAll('[data-csv-table]');
containers.forEach(renderCsvTable);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initCsvTables);
} else {
initCsvTables();
}
})();

106
assets/js/sidenotes.js Normal file
View file

@ -0,0 +1,106 @@
/**
* sidenotes.js
* Takes Hugo-rendered Goldmark footnotes and repositions them
* as margin notes alongside the text that references them.
*
* Hugo/Goldmark renders footnotes as:
* - References: <sup id="fnref:N"><a href="#fn:N">N</a></sup>
* or <sup id="fnref1:N"><a href="#fn:N">N</a></sup> (for duplicate refs)
* - Section: <section class="footnotes"> <ol> <li id="fn:N"> </li> </ol> </section>
*/
(function () {
'use strict';
const MARGIN_TOP_PX = 12; // minimum vertical gap between sidenotes
function initSidenotes() {
const container = document.querySelector('.sidenote-layout .content-body');
if (!container) return;
const footnotesSection = container.querySelector('.footnotes, section.footnotes');
if (!footnotesSection) return;
// Collect all footnote reference <sup> elements
const refs = container.querySelectorAll('sup[id^="fnref"]');
if (refs.length === 0) return;
// Check viewport: skip sidenote placement on narrow screens
if (window.innerWidth < 900) {
container.classList.add('sidenotes-fallback');
footnotesSection.style.display = '';
return;
}
let lastBottom = 0;
refs.forEach(function (sup) {
// Get the footnote id from the <a> inside the <sup>
const anchor = sup.querySelector('a[href^="#fn"]');
if (!anchor) return;
const fnId = anchor.getAttribute('href').replace('#', '');
const footnoteLi = footnotesSection.querySelector('#' + CSS.escape(fnId));
if (!footnoteLi) return;
// Extract footnote content (skip the back-reference link)
const clone = footnoteLi.cloneNode(true);
const backlinks = clone.querySelectorAll('.footnote-backref, a[href^="#fnref"]');
backlinks.forEach(function (bl) { bl.remove(); });
const noteHTML = clone.innerHTML.trim();
// Extract footnote number from the sup text
const noteNumber = anchor.textContent.trim();
// Create sidenote element
const sidenote = document.createElement('span');
sidenote.className = 'sidenote';
sidenote.setAttribute('role', 'note');
sidenote.innerHTML =
'<span class="sidenote-number">' + noteNumber + '.</span> ' + noteHTML;
// Append to content-body (absolutely positioned)
container.appendChild(sidenote);
// Position vertically aligned with the reference
const containerRect = container.getBoundingClientRect();
const supRect = sup.getBoundingClientRect();
let desiredTop = supRect.top - containerRect.top;
// Prevent overlap with previous sidenote
if (desiredTop < lastBottom + MARGIN_TOP_PX) {
desiredTop = lastBottom + MARGIN_TOP_PX;
}
sidenote.style.top = desiredTop + 'px';
// Track the bottom of this sidenote for collision avoidance
lastBottom = desiredTop + sidenote.offsetHeight;
});
// Hide the original footnotes section
footnotesSection.style.display = 'none';
}
// Run on load
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initSidenotes);
} else {
initSidenotes();
}
// Re-run on resize (debounced)
let resizeTimer;
window.addEventListener('resize', function () {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () {
// Remove existing sidenotes and re-init
document.querySelectorAll('.sidenote').forEach(function (el) { el.remove(); });
const fs = document.querySelector('.sidenote-layout .content-body .footnotes, .sidenote-layout .content-body section.footnotes');
if (fs) fs.style.display = '';
var fb = document.querySelector('.sidenotes-fallback');
if (fb) fb.classList.remove('sidenotes-fallback');
initSidenotes();
}, 250);
});
})();