/* ============================================================
   SSMIG-TI — Società Svizzera di Medicina Interna Generale
   Ticino. Redesign by Webbro.ch
   Brand preserved: colore #059CCA, font Montserrat + Lato
   ============================================================ */

:root {
  /* Brand colors (from original site) */
  --blue:        #059cca;
  --blue-dark:   #0581ca;
  --blue-deep:   #046a9e;
  --blue-50:     #eaf7fc;
  --blue-100:    #d3eef8;

  /* Neutrals */
  --ink:         #1f2933;
  --body:        #44505c;
  --muted:       #6b7682;
  --line:        #e4e9ee;
  --bg:          #ffffff;
  --bg-soft:     #f5f8fb;
  --bg-deep:     #0d2a38;

  /* Type */
  --f-head: 'Montserrat', system-ui, sans-serif;
  --f-body: 'Lato', system-ui, sans-serif;

  /* Geometry */
  --wrap: 1180px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 10px rgba(13, 42, 56, .06);
  --shadow:    0 14px 40px rgba(13, 42, 56, .10);
  --shadow-lg: 0 28px 70px rgba(13, 42, 56, .16);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--f-body);
  color: var(--body);
  background: var(--bg);
  line-height: 1.7;
  font-size: 17px;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--blue-dark); text-decoration: none; transition: color .25s var(--ease); }
a:hover { color: var(--blue-deep); }

h1, h2, h3, h4 {
  font-family: var(--f-head);
  color: var(--ink);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* ---------- Layout helpers ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 22px; }
.section { padding: clamp(56px, 9vw, 110px) 0; }
.section--soft { background: var(--bg-soft); }
.center { text-align: center; }

.eyebrow {
  display: inline-block;
  font-family: var(--f-head);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 14px;
}

.section-title {
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  margin-bottom: 16px;
}
.section-lead {
  max-width: 640px;
  color: var(--muted);
  font-size: 1.06rem;
}
.center .section-lead { margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: .95rem;
  padding: 14px 28px;
  border-radius: 999px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease),
              background .25s var(--ease), color .25s var(--ease);
}
.btn--primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  box-shadow: 0 12px 26px rgba(5, 156, 202, .34);
}
.btn--primary:hover { color: #fff; transform: translateY(-3px); box-shadow: 0 18px 34px rgba(5, 156, 202, .45); }
.btn--ghost { background: transparent; color: var(--blue-dark); border-color: var(--blue); }
.btn--ghost:hover { background: var(--blue); color: #fff; transform: translateY(-3px); }
.btn--light { background: #fff; color: var(--blue-dark); }
.btn--light:hover { color: var(--blue-deep); transform: translateY(-3px); box-shadow: var(--shadow); }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.site-header.scrolled { box-shadow: var(--shadow-sm); border-color: var(--line); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 14px;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand img { height: 50px; width: auto; transition: transform .3s var(--ease); }
.brand:hover img { transform: scale(1.04); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong {
  font-family: var(--f-head);
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--blue-dark);
  letter-spacing: .02em;
}
.brand-text span { font-size: .68rem; color: var(--muted); letter-spacing: .03em; }

.nav-links { display: flex; align-items: center; gap: 6px; list-style: none; }
.nav-links a {
  font-family: var(--f-head);
  font-weight: 600;
  font-size: .94rem;
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 999px;
  position: relative;
  transition: color .25s var(--ease), background .25s var(--ease);
}
.nav-links a:hover { color: var(--blue-dark); background: var(--blue-50); }
.nav-links a.active { color: var(--blue-dark); background: var(--blue-50); }
.nav-cta { margin-left: 8px; }

.nav-toggle {
  display: none;
  width: 46px; height: 46px;
  border: none; background: var(--blue-50); border-radius: 12px;
  cursor: pointer; position: relative;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 20px; height: 2px; background: var(--blue-dark); border-radius: 2px;
  transform: translate(-50%, -50%); transition: transform .3s var(--ease), opacity .2s;
}
.nav-toggle span::before { transform: translate(-50%, -7px); }
.nav-toggle span::after  { transform: translate(-50%, 5px); }
.nav-toggle.open span { background: transparent; }
.nav-toggle.open span::before { transform: translate(-50%, -50%) rotate(45deg); }
.nav-toggle.open span::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  padding: clamp(70px, 12vw, 140px) 0 clamp(60px, 9vw, 120px);
  background:
    radial-gradient(1100px 540px at 78% -8%, var(--blue-100), transparent 60%),
    radial-gradient(800px 460px at -5% 20%, #eef9fd, transparent 55%),
    var(--bg);
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(5,156,202,.10) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
  pointer-events: none;
}
.hero .wrap { position: relative; z-index: 1; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(30px, 5vw, 64px);
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.1rem, 5.4vw, 3.7rem);
  font-weight: 800;
  margin-bottom: 20px;
}
.hero h1 .hl {
  background: linear-gradient(120deg, var(--blue), var(--blue-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 1.16rem; color: var(--body); max-width: 540px; margin-bottom: 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 9px;
  background: #fff; border: 1px solid var(--line);
  padding: 8px 16px; border-radius: 999px;
  font-family: var(--f-head); font-weight: 600; font-size: .82rem; color: var(--blue-dark);
  box-shadow: var(--shadow-sm); margin-bottom: 22px;
}
.hero-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: #16c172; box-shadow: 0 0 0 4px rgba(22,193,114,.18); }

.hero-visual { position: relative; }
.hero-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 4 / 3.2;
}
.hero-card img { width: 100%; height: 100%; object-fit: cover; }
.hero-card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(4,33,46,.55));
}
.hero-float {
  position: absolute; left: -22px; bottom: 26px; z-index: 2;
  background: #fff; border-radius: 16px; padding: 16px 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px;
}
.hero-float .num { font-family: var(--f-head); font-weight: 800; font-size: 1.7rem; color: var(--blue-dark); line-height: 1; }
.hero-float .lbl { font-size: .8rem; color: var(--muted); }

/* ---------- Stats strip ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.stat { text-align: center; padding: 8px; }
.stat .n {
  font-family: var(--f-head); font-weight: 800;
  font-size: clamp(2rem, 4vw, 2.8rem); color: var(--blue-dark); line-height: 1;
}
.stat .l { color: var(--muted); font-size: .92rem; margin-top: 8px; }

/* ============================================================
   CARDS / FEATURES
   ============================================================ */
.grid { display: grid; gap: 26px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 28px;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--blue-100); }
.card .ico {
  width: 54px; height: 54px; border-radius: 14px;
  display: grid; place-items: center; margin-bottom: 18px;
  background: var(--blue-50); color: var(--blue-dark);
}
.card .ico svg { width: 26px; height: 26px; }
.card h3 { font-size: 1.2rem; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: .98rem; }

/* ============================================================
   MISSION split
   ============================================================ */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 5vw, 60px); align-items: center; }
.split-media {
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
  aspect-ratio: 5/4;
}
.split-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.split-media:hover img { transform: scale(1.06); }
.checklist { list-style: none; margin-top: 22px; display: grid; gap: 14px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; }
.checklist .ck {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue-50); color: var(--blue-dark);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; margin-top: 2px;
}

/* ============================================================
   GALLERY
   ============================================================ */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 180px;
  gap: 14px;
}
.gallery a {
  position: relative; overflow: hidden; border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.gallery a img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.gallery a::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(5,156,202,.45));
  opacity: 0; transition: opacity .35s var(--ease);
}
.gallery a:hover img { transform: scale(1.09); }
.gallery a:hover::after { opacity: 1; }
.gallery .wide { grid-column: span 2; }
.gallery .tall { grid-row: span 2; }

/* ============================================================
   TIMELINE (programma / agenda)
   ============================================================ */
.timeline { position: relative; max-width: 760px; margin-inline: auto; }
.timeline::before {
  content: ''; position: absolute; left: 18px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(var(--blue), var(--blue-100));
}
.tl-item { position: relative; padding: 0 0 30px 56px; }
.tl-item::before {
  content: ''; position: absolute; left: 11px; top: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--blue);
  box-shadow: 0 0 0 5px var(--blue-50);
}
.tl-item h4 { font-size: 1.06rem; margin-bottom: 4px; }
.tl-item .when { font-family: var(--f-head); font-weight: 700; color: var(--blue-dark); font-size: .85rem; letter-spacing: .04em; }
.tl-item p { color: var(--muted); font-size: .95rem; margin-top: 4px; }

/* ============================================================
   COMITATO (member cards)
   ============================================================ */
.member {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 26px; transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.member:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--blue-100); }
.member .avatar {
  width: 66px; height: 66px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff; display: grid; place-items: center; margin-bottom: 16px;
  font-family: var(--f-head); font-weight: 800; font-size: 1.3rem;
}
.member .role {
  display: inline-block; font-family: var(--f-head); font-weight: 700;
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--blue-dark); background: var(--blue-50);
  padding: 4px 12px; border-radius: 999px; margin-bottom: 12px;
}
.member h3 { font-size: 1.18rem; margin-bottom: 6px; }
.member .spec { color: var(--muted); font-size: .92rem; margin-bottom: 12px; min-height: 1.2em; }
.member .meta { font-size: .9rem; color: var(--body); display: grid; gap: 6px; }
.member .meta a { display: inline-flex; gap: 8px; align-items: center; word-break: break-word; }
.member .meta svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--blue); }

/* ============================================================
   STATUTI (articles)
   ============================================================ */
.statuti-layout { display: grid; grid-template-columns: 250px 1fr; gap: 40px; align-items: start; }
.statuti-toc {
  position: sticky; top: 100px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.statuti-toc h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 14px; }
.statuti-toc ol { list-style: none; counter-reset: art; display: grid; gap: 2px; }
.statuti-toc a {
  display: block; font-size: .9rem; color: var(--body);
  padding: 8px 12px; border-radius: 9px; font-weight: 600;
  font-family: var(--f-head); transition: background .2s, color .2s;
}
.statuti-toc a:hover, .statuti-toc a.active { background: var(--blue-50); color: var(--blue-dark); }

.article {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 32px; margin-bottom: 20px; scroll-margin-top: 100px;
  transition: box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.article:hover { box-shadow: var(--shadow-sm); border-color: var(--blue-100); }
.article h3 {
  font-size: 1.25rem; margin-bottom: 14px; display: flex; align-items: center; gap: 14px;
}
.article h3 .num {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  background: var(--blue-50); color: var(--blue-dark);
  display: grid; place-items: center; font-size: .95rem; font-weight: 800;
}
.article p { color: var(--body); margin-bottom: 12px; }
.article p:last-child { margin-bottom: 0; }
.article ul { margin: 6px 0 6px 4px; list-style: none; display: grid; gap: 10px; }
.article ul li { display: flex; gap: 11px; }
.article ul li::before { content: '▸'; color: var(--blue); font-weight: 700; }

/* ============================================================
   SPONSOR marquee
   ============================================================ */
.sponsor-track { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.sponsor-row { display: flex; gap: 56px; align-items: center; width: max-content; animation: marquee 38s linear infinite; }
.sponsor-track:hover .sponsor-row { animation-play-state: paused; }
.sponsor-row img {
  height: 42px; width: auto; object-fit: contain;
  filter: grayscale(1); opacity: .62; transition: filter .3s, opacity .3s;
}
.sponsor-row img:hover { filter: grayscale(0); opacity: 1; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============================================================
   CTA band
   ============================================================ */
.cta-band {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--blue-deep), var(--blue-dark) 55%, var(--blue));
  border-radius: var(--radius-lg); color: #fff;
  padding: clamp(40px, 6vw, 70px);
  box-shadow: var(--shadow-lg);
}
.cta-band::after {
  content: ''; position: absolute; right: -60px; top: -60px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
}
.cta-band h2 { color: #fff; font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin-bottom: 14px; }
.cta-band p { color: rgba(255,255,255,.9); max-width: 560px; margin-bottom: 26px; }
.cta-band .hero-actions { position: relative; z-index: 1; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { background: var(--bg-deep); color: #c4d2da; padding: 64px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 36px; }
.site-footer h4 { color: #fff; font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 18px; }
.site-footer ul { list-style: none; display: grid; gap: 10px; }
.site-footer a { color: #c4d2da; font-size: .95rem; }
.site-footer a:hover { color: #fff; }
.footer-brand img { height: 48px; background: #fff; padding: 7px 10px; border-radius: 10px; margin-bottom: 16px; }
.footer-brand p { font-size: .94rem; color: #93a6b1; max-width: 280px; }
.footer-contact li { display: flex; gap: 10px; font-size: .94rem; align-items: flex-start; }
.footer-contact svg { width: 16px; height: 16px; color: var(--blue); flex: 0 0 auto; margin-top: 3px; }
.footer-bottom {
  margin-top: 46px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  font-size: .85rem; color: #7f95a1;
}
.footer-bottom a { color: #9fb2bc; }

/* ---------- Page hero (interior) ---------- */
.page-hero {
  background:
    radial-gradient(800px 400px at 85% -20%, var(--blue-100), transparent 60%),
    var(--bg-soft);
  padding: clamp(56px, 9vw, 100px) 0 clamp(40px, 6vw, 66px);
  border-bottom: 1px solid var(--line);
}
.page-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; margin-bottom: 14px; }
.page-hero p { max-width: 620px; color: var(--muted); font-size: 1.08rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 18px; font-family: var(--f-head); font-weight: 600; }
.crumbs a { color: var(--blue-dark); }

/* ============================================================
   Scroll reveal
   ============================================================ */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .08s; }
.reveal.d2 { transition-delay: .16s; }
.reveal.d3 { transition-delay: .24s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .sponsor-row { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: -1; max-width: 520px; }
  .split { grid-template-columns: 1fr; }
  .split-media { order: -1; }
  .statuti-layout { grid-template-columns: 1fr; }
  .statuti-toc { position: static; display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .nav-links {
    position: fixed; top: 78px; right: 16px; left: auto;
    width: min(86vw, 320px);
    flex-direction: column; align-items: stretch; gap: 4px;
    background: #fff; padding: 14px; border: 1px solid var(--line);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    transform-origin: top right;
    opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.96);
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
    z-index: 90;
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { font-size: 1.05rem; padding: 13px 18px; }
  .nav-cta { margin: 8px 0 0; }
  .nav-cta .btn { justify-content: center; }
  .nav-toggle { display: block; z-index: 95; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 30px 16px; }
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; }
  .gallery .wide { grid-column: span 2; }
  .gallery .tall { grid-row: span 1; }
  .footer-grid { grid-template-columns: 1fr; gap: 30px; }
  body { font-size: 16px; }
}
.nav-backdrop {
  position: fixed; inset: 0; background: rgba(13,42,56,.35);
  opacity: 0; visibility: hidden; transition: opacity .3s; z-index: 80;
}
.nav-backdrop.show { opacity: 1; visibility: visible; }
