/* ================================================================
   Novanta APS — public.css
   Sito pubblico SEO-friendly. Mobile-first, typography-focused.
   ================================================================ */

:root {
  --accent: #2E7D32;
  --accent-hover: #1B5E20;
  --accent-bright: #66BB6A;
  --sage: #43A047;
  --stone: #6E8568;
  --blue: #2E5F8A;
  --text: #1C2418;
  --text-soft: #4A574A;
  --text-muted: #7E8A7E;
  --bg: #FAFAF6;
  --panel: #FFFFFF;
  --panel-cream: #F0F4ED;
  --line: #D8E0D2;
  --line-soft: #E8EDE3;
  --gold: #C9A227;
  --success: #2E7D32;
  --warning: #ED6C02;
  --danger: #C62828;
  --shadow: 0 8px 24px rgba(28,36,24,0.08);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Work Sans', system-ui, -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  -webkit-overflow-scrolling: touch;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0 0 0.6em; color: var(--text); }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h3 { font-size: clamp(1.3rem, 3vw, 1.6rem); }

.pub-container { max-width: 1080px; margin: 0 auto; padding: 32px 20px; }
.pub-container-narrow { max-width: 720px; margin: 0 auto; padding: 32px 20px; }

/* ── HEADER ─────────────────────────────────────────────────────── */
.pub-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
  position: sticky; top: 0; z-index: 100;
}
.pub-header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 14px 20px;
  display: flex; align-items: center; gap: 24px;
}
.pub-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-family: var(--font-display); font-size: 22px; color: var(--text); }
.pub-brand:hover { text-decoration: none; }
.pub-brand-icon { color: var(--accent); font-size: 26px; }
.pub-nav { flex: 1; display: flex; gap: 22px; justify-content: center; }
.pub-nav a { color: var(--text); font-weight: 500; font-size: 15px; padding: 6px 4px; border-bottom: 2px solid transparent; transition: border-color 0.15s, color 0.15s; }
.pub-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }
.pub-cta-aiuta {
  background: var(--accent); color: #fff !important;
  padding: 10px 20px; border-radius: 24px;
  font-weight: 600; font-size: 14px;
  transition: background 0.15s, transform 0.1s;
}
.pub-cta-aiuta:hover { background: var(--accent-hover); text-decoration: none; }
.pub-cta-aiuta:active { transform: scale(0.97); }

.pub-mobile-toggle { display: none; background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--text); padding: 10px 14px; min-width: 44px; min-height: 44px; -webkit-tap-highlight-color: transparent; }
.pub-mobile-toggle:active { background: rgba(0,0,0,0.06); border-radius: 6px; }
.pub-mobile-nav { display: none; flex-direction: column; gap: 0; padding: 0 20px 20px; border-top: 1px solid var(--line); }
.pub-mobile-nav a { padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 500; }
.pub-mobile-nav a.pub-cta-aiuta { margin-top: 12px; text-align: center; border-bottom: 0; color: #fff; }

@media (max-width: 860px) {
  .pub-header-inner { padding: 6px 14px; gap: 12px; }
  .pub-brand { font-size: 17px; gap: 8px; }
  .pub-brand-logo { max-height: 32px; max-width: 36px; }
  .pub-nav { display: none; }
  .pub-cta-aiuta { display: none; }
  .pub-mobile-toggle { display: block; margin-left: auto; font-size: 22px; padding: 6px 10px; min-width: 40px; min-height: 40px; }
  .pub-mobile-nav { display: flex; }
  .pub-mobile-nav[hidden] { display: none; }
}

/* ── HERO HOME ─────────────────────────────────────────────────── */
.pub-hero {
  position: relative; isolation: isolate;
  background: linear-gradient(160deg, #2E7D32 0%, #1B3A1F 100%);
  color: #fff; padding: 72px 20px 90px; text-align: center; overflow: hidden;
}
.pub-hero-bg { position: absolute; inset: 0; z-index: -2; background-position: center; background-size: cover; opacity: 0.55; }
.pub-hero-bg-overlay { position: absolute; inset: 0; z-index: -1; background: linear-gradient(160deg, rgba(46,125,50,0.78) 0%, rgba(27,58,31,0.92) 100%); }
.pub-hero-inner { max-width: 760px; margin: 0 auto; position: relative; z-index: 1; }
.pub-hero h1 { color: #fff; font-size: clamp(1.6rem, 4vw, 2.5rem); margin-bottom: 14px; line-height: 1.2; }
.pub-hero-slogan-top { display: inline-block; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.85; margin-bottom: 14px; padding: 6px 14px; border: 1px solid rgba(255,255,255,0.4); border-radius: 999px; }
.pub-hero-motto { font-size: clamp(0.95rem, 2vw, 1.15rem); font-style: italic; opacity: 0.92; margin-bottom: 28px; max-width: 580px; margin-left:auto; margin-right:auto; }
.pub-hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; margin-top: 40px; }
.pub-hero-stat { background: rgba(255,255,255,0.1); padding: 24px 16px; border-radius: 14px; backdrop-filter: blur(8px); }
.pub-hero-stat-num { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700; font-family: var(--font-display); color: #fff; }
.pub-hero-stat-label { font-size: 13px; opacity: 0.85; margin-top: 4px; }

/* ── CARDS PROGETTI ────────────────────────────────────────────── */
.pub-projects-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px; margin: 40px 0;
}
.pub-project-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s;
}
.pub-project-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(28,36,24,0.12); }
.pub-project-cover { width: 100%; aspect-ratio: 16/9; background: var(--bg); object-fit: cover; }
.pub-project-body { padding: 22px; }
.pub-project-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.pub-project-story { font-size: 14px; color: var(--text-soft); margin-bottom: 16px; line-height: 1.5; }
.pub-project-progress { margin-bottom: 14px; }
.pub-project-progress-bar { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; margin-top: 8px; }
.pub-project-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); transition: width 0.8s; }
.pub-project-progress-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-soft); }
.pub-project-cta { display: inline-block; background: var(--accent); color: #fff !important; padding: 10px 20px; border-radius: 8px; font-weight: 600; }
.pub-project-cta:hover { background: var(--accent-hover); text-decoration: none; }

/* ── HISTORICAL TIMELINE ──────────────────────────────────────── */
.pub-timeline { max-width: 880px; margin: 40px auto; position: relative; }
.pub-timeline::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--line); transform: translateX(-50%); }
.pub-timeline-item { padding: 16px 32px; position: relative; margin-bottom: 16px; }
.pub-timeline-item:nth-child(odd) { padding-right: 50%; text-align: right; }
.pub-timeline-item:nth-child(even) { padding-left: 50%; }
.pub-timeline-item::before {
  content: ''; position: absolute; left: 50%; top: 24px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
  transform: translateX(-50%); z-index: 1;
}
.pub-timeline-year { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--accent); }
.pub-timeline-amount { font-size: 18px; font-weight: 600; color: var(--text); }
.pub-timeline-desc { font-size: 14px; color: var(--text-soft); margin-top: 4px; }
.pub-timeline-where { font-size: 13px; color: var(--text-muted); font-style: italic; }
@media (max-width: 768px) {
  .pub-timeline::before { left: 16px; }
  .pub-timeline-item, .pub-timeline-item:nth-child(odd), .pub-timeline-item:nth-child(even) { padding: 16px 16px 16px 48px; text-align: left; }
  .pub-timeline-item::before { left: 16px; }
}

/* ── FORMS ──────────────────────────────────────────────────── */
.pub-form { background: var(--panel); padding: 28px; border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.pub-form-row { margin-bottom: 16px; }
.pub-form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.pub-form-row input, .pub-form-row textarea, .pub-form-row select {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 8px;
  font-size: 16px; background: var(--bg); outline: none;
  font-family: inherit; transition: border-color 0.15s;
}
.pub-form-row input:focus, .pub-form-row textarea:focus, .pub-form-row select:focus { border-color: var(--accent); }
.pub-btn-primary { background: var(--accent); color: #fff; border: 0; padding: 12px 28px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.15s; font-family: inherit; }
.pub-btn-primary:hover { background: var(--accent-hover); }

/* ── FOOTER ────────────────────────────────────────────────── */
.pub-footer {
  background: #1B3A1F; color: #E8F0E5; margin-top: 60px;
  padding: 48px 20px 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
}
.pub-footer-inner { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 36px; }
.pub-footer-col { font-size: 14px; line-height: 1.7; }
.pub-footer-col a { color: #E8F0E5; display: block; padding: 2px 0; }
.pub-footer-col a:hover { color: var(--accent-bright); text-decoration: none; }
.pub-footer-brand { font-family: var(--font-display); font-size: 24px; color: #fff; margin-bottom: 8px; }
.pub-footer-motto { font-style: italic; opacity: 0.85; font-size: 13px; }
.pub-footer-title { font-weight: 600; margin-bottom: 12px; color: #fff; font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; }
.pub-footer-bottom { max-width: 1080px; margin: 32px auto 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); text-align: center; font-size: 12px; opacity: 0.7; }

/* ── NEWS LIST ────────────────────────────────────────────── */
.pub-news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 32px 0; }
.pub-news-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: transform 0.2s; }
.pub-news-card:hover { transform: translateY(-2px); }
.pub-news-cover { width: 100%; aspect-ratio: 16/9; background: var(--bg); object-fit: cover; }
.pub-news-body { padding: 18px; }
.pub-news-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.pub-news-date { font-size: 12px; color: var(--text-muted); }
.pub-news-excerpt { font-size: 14px; color: var(--text-soft); margin-top: 8px; }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.pub-empty { text-align: center; padding: 60px 20px; color: var(--text-soft); }
.pub-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }

/* ── CONTATTI / IBAN BLOCK ────────────────────────────────── */
.pub-iban-block { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin: 16px 0; }
.pub-iban-block-title { font-weight: 600; margin-bottom: 8px; }
.pub-iban-code { font-family: monospace; font-size: 14px; color: var(--text-soft); word-break: break-all; }

/* ── 5×1000 ───────────────────────────────────────────────── */
.pub-cf-big { background: var(--accent); color: #fff; padding: 24px; text-align: center; border-radius: 14px; margin: 24px 0; }
.pub-cf-big-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; }
.pub-cf-big-num { font-family: monospace; font-size: clamp(1.4rem, 5vw, 2.2rem); font-weight: 700; margin-top: 8px; letter-spacing: 0.05em; }

/* ── EVENTS LIST ──────────────────────────────────────────── */
.pub-event-card { display: flex; gap: 18px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; transition: transform 0.2s; }
.pub-event-card:hover { transform: translateY(-2px); }
.pub-event-date { flex-shrink: 0; text-align: center; min-width: 70px; padding: 10px; background: var(--bg); border-radius: 10px; }
.pub-event-date-day { font-size: 28px; font-weight: 700; line-height: 1; color: var(--accent); }
.pub-event-date-month { font-size: 11px; text-transform: uppercase; color: var(--text-soft); margin-top: 4px; letter-spacing: 0.05em; }
.pub-event-info { flex: 1; }
.pub-event-title { font-family: var(--font-display); font-size: 22px; margin-bottom: 4px; font-weight: 600; }
.pub-event-meta { font-size: 13px; color: var(--text-soft); }

/* ── SECTION TITLE ────────────────────────────────────────── */
.pub-section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  text-align: center; margin: 48px 0 24px;
  color: var(--text);
}
.pub-section-subtitle { text-align: center; color: var(--text-soft); margin: -12px 0 32px; font-size: 16px; max-width: 600px; margin-left: auto; margin-right: auto; padding: 0 20px; }

/* ── BRAND LOGO (header = square, footer = full) ──────────── */
.pub-brand-logo { max-height: 40px; max-width: 48px; object-fit: contain; }
.pub-footer-logo { max-height: 56px; max-width: 220px; width: auto; object-fit: contain; }
.pub-footer-brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── HERO LOGO + CTA (full version, larger) ──────────────── */
.pub-hero-logo {
  max-width: min(360px, 70%); max-height: 180px;
  width: auto; height: auto; object-fit: contain;
  margin: 0 auto 28px; display: block;
  padding: 0; background: transparent; border-radius: 0;
  filter: drop-shadow(0 12px 40px rgba(0,0,0,0.22));
}
.pub-hero-icon {
  width: 120px; height: 120px;
  margin: 0 auto 28px;
  display: grid; place-items: center;
  font-size: 64px; color: #fff;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  backdrop-filter: blur(6px);
}
.pub-hero-title { color: #fff; font-size: clamp(1.6rem, 4vw, 2.5rem); margin-bottom: 14px; line-height: 1.2; letter-spacing: -0.005em; }
.pub-hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 36px; }
.pub-btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 10px; }
.pub-btn-ghost {
  display: inline-block; background: transparent; color: #fff !important;
  border: 1.5px solid rgba(255,255,255,0.6);
  padding: 12px 28px; border-radius: 8px; font-weight: 600;
  text-decoration: none; transition: background 0.15s, border-color 0.15s;
}
.pub-btn-ghost:hover { background: rgba(255,255,255,0.12); border-color: #fff; text-decoration: none; }
.pub-btn-link { color: var(--accent); font-weight: 600; }
.pub-btn-on-dark { background: #fff; color: var(--accent) !important; border: 0; }
.pub-btn-on-dark:hover { background: #f5f5f5; }

/* ── SEZIONE GENERICA ───────────────────────────────────── */
.pub-section { padding-top: 24px; padding-bottom: 24px; }

/* ── INTRO NARRATIVA ────────────────────────────────────── */
.pub-intro { background: var(--panel); border-bottom: 1px solid var(--line); padding: 64px 0; }
.pub-intro-inner {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 48px; align-items: center;
}
.pub-intro-text p { font-size: 17px; color: var(--text-soft); margin: 14px 0; line-height: 1.7; }
.pub-intro-text .pub-section-title { text-align: left; margin: 0 0 16px; }
.pub-intro-aside { display: flex; flex-direction: column; gap: 14px; }
.pub-intro-card {
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; text-align: center;
}
.pub-intro-card-num { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--accent); }
.pub-intro-card-label { font-size: 13px; color: var(--text-soft); margin-top: 4px; }
@media (max-width: 768px) {
  .pub-intro-inner { grid-template-columns: 1fr; gap: 32px; }
  .pub-intro-text .pub-section-title { text-align: center; }
}

/* ── AREE DI INTERVENTO ─────────────────────────────────── */
.pub-areas { background: linear-gradient(180deg, var(--bg) 0%, var(--panel) 100%); padding: 64px 0; }
.pub-areas-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px; margin-top: 32px;
}
.pub-area-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px 24px; text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.pub-area-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.pub-area-icon { font-size: 44px; margin-bottom: 14px; }
.pub-area-card h3 { font-family: var(--font-display); font-size: 22px; margin-bottom: 10px; color: var(--accent); }
.pub-area-card p { font-size: 15px; color: var(--text-soft); line-height: 1.6; margin: 0; }

/* ── PROSSIMO EVENTO ───────────────────────────────────── */
.pub-next-event {
  background: linear-gradient(135deg, var(--gold) 0%, #B8911F 100%);
  color: #fff; padding: 56px 20px; margin: 32px 0;
}
.pub-next-event-inner { max-width: 800px; margin: 0 auto; text-align: center; }
.pub-next-event-tag {
  display: inline-block; background: rgba(255,255,255,0.2);
  padding: 6px 16px; border-radius: 20px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 14px;
}
.pub-next-event-title { color: #fff; font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 14px; }
.pub-next-event-meta { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; font-size: 15px; margin-bottom: 18px; opacity: 0.95; }
.pub-next-event-desc { font-size: 16px; line-height: 1.6; max-width: 600px; margin: 0 auto 24px; opacity: 0.95; }
.pub-next-event .pub-btn-primary { background: #fff; color: var(--gold) !important; }
.pub-next-event .pub-btn-primary:hover { background: #f5f5f5; }

/* ── MEMORIAL WALL TEASER ──────────────────────────────── */
.pub-memorial {
  background: linear-gradient(160deg, #1B3A1F 0%, #14201A 100%);
  color: #fff; padding: 64px 20px; margin-top: 24px;
}
.pub-memorial-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.pub-memorial-text p { font-size: 17px; line-height: 1.7; opacity: 0.92; margin: 16px 0 28px; }
.pub-section-title-light { color: #fff !important; }

/* ── SOSTIENI NOVANTA ──────────────────────────────────── */
.pub-support-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px; margin-top: 32px;
}
.pub-support-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px 20px; text-align: center;
  color: var(--text) !important;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.pub-support-card:hover {
  transform: translateY(-3px); border-color: var(--accent);
  box-shadow: var(--shadow); text-decoration: none;
}
.pub-support-icon { font-size: 36px; font-weight: 700; font-family: var(--font-display); color: var(--accent); margin-bottom: 10px; }
.pub-support-title { font-weight: 600; font-size: 17px; margin-bottom: 6px; }
.pub-support-desc { font-size: 13px; color: var(--text-soft); }

/* ── DARK MODE auto ───────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --text: #E8F0E5; --text-soft: #C8D2C5; --text-muted: #8FA68C;
    --bg: #14201A; --panel: #1F2D24; --panel-cream: #1B2820;
    --line: #2F3F33; --line-soft: #243029;
  }
}

/* ── Defensive: assicura visibilita' del contenuto pubblico anche se
   un'estensione del browser inietta `display:none !important` tramite
   filterlist. Specificity 0,0,0,4 con !important vince qualsiasi
   selettore di classe (0,0,1,0) anche con !important. ── */
html body main { display: block !important; visibility: visible !important; opacity: 1 !important; min-height: 50vh; }
html body main section { display: block !important; visibility: visible !important; opacity: 1 !important; }
html body main article { display: block !important; visibility: visible !important; opacity: 1 !important; }
html body main aside  { display: block !important; visibility: visible !important; opacity: 1 !important; }
html body main figure { display: block !important; visibility: visible !important; opacity: 1 !important; }
html body main div    { visibility: visible !important; opacity: 1 !important; }
html body main h1, html body main h2, html body main h3, html body main h4,
html body main p,  html body main span, html body main a,  html body main img {
  visibility: visible !important; opacity: 1 !important;
}
/* Forza il color text nei prose se per qualche motivo eredita transparent */
html body main .pub-prose, html body main .pub-page-lead,
html body main .pub-page-title, html body main .pub-section-h2 {
  color: var(--text) !important;
}
