/* ══════════════════════════════════════════════════════
   global.css — algo-freedom society
   Stili condivisi da tutte le pagine del progetto
   ══════════════════════════════════════════════════════ */

/* ─── Variabili CSS ───────────────────────────────────── */
:root {
  --nav-1: #1f3550;
  --nav-2: #2f5f86;
  --nav-3: #2b4f72;
  --accent: #69a8e8;
  --accent-2: #3f79b7;
  --text: #0f172a;
  --muted: #5b6678;
  --bg: #eef2f7;
  --card: #ffffff;
  --border: rgba(15, 23, 42, .10);
  --shadow: 0 10px 24px rgba(15, 23, 42, .10);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, .15);
  --radius: 12px;
  --radius-sm: 10px;
  --container: 1200px;
}

/* ─── Reset & Base ────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 22px;
}
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ─── Header / Nav ────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: #1e3a5f;
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
  backdrop-filter: blur(6px);
}
.nav {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  color: #fff;
}
.brand img { height: 34px; flex: 0 0 auto; filter: drop-shadow(0 8px 12px rgba(0,0,0,.25)); }
.brand-name {
  font-weight: 700;
  letter-spacing: .2px;
  font-size: 18px;
  display: flex;
  gap: 6px;
  align-items: baseline;
  white-space: nowrap;
}
.brand-name span:last-child { font-weight: 100; opacity: .9; }

nav[aria-label="Primary"] { flex: 1 1 auto; display: flex; justify-content: right; }
.menu {
  list-style: none;
  display: flex;
  gap: 34px;
  margin: 0; padding: 0;
  align-items: center;
  color: rgba(255,255,255,.95);
  font-weight: 600;
  font-size: 15px;
}
.menu a { position: relative; display: inline-block; padding: 12px 0; opacity: .92; }
.menu a:hover { opacity: 1; }
.menu a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(105,168,232,.55));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .18s ease;
}
.menu a.active::after { transform: scaleX(1); }
.menu a:hover::after { transform: scaleX(1); opacity: .65; }

.nav-cta { display: flex; justify-content: flex-end; }
.btn-join {
  background: #3e79b8;
  color: #fff;
  padding: 10px 25px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.22);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-join:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(0,0,0,.28); background: #3a7bc8; }

/* ─── Language switch button ──────────────────────────── */
.btn-lang-switch {
  background: transparent;
  color: rgba(255,255,255,.90);
  padding: 7px 16px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.35);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  cursor: pointer;
  transition: background .13s ease, border-color .13s ease;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.btn-lang-switch:hover {
  background: rgba(255,255,255,.13);
  border-color: rgba(255,255,255,.55);
  color: #fff;
}

/* ─── Section commons ─────────────────────────────────── */
main { padding: 0; }
.section-title {
  margin: 18px 0 4px;
  font-size: 28px;
  font-weight: 900;
  color: #1b2a44;
  letter-spacing: -.2px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.title-divider {
  flex: 1;
  height: 1px;
  background: rgba(15, 23, 42, .12);
}
.section-sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
}
.panel { padding: 42px 0 28px; }
.panel + .panel { border-top: 1px solid rgba(15,23,42,.08); }

/* ─── CTA Band (centrata — usata in about, research, publications, contact, profile) ── */
.cta-band {
  position: relative;
  background:
    radial-gradient(820px 280px at 35% 10%, rgba(105,168,232,.16), transparent 62%),
    linear-gradient(90deg, var(--nav-1), var(--nav-3));
  color: #fff;
  padding: 42px 0;
  border-top: 1px solid rgba(255,255,255,.10);
  border-bottom: 1px solid rgba(255,255,255,.10);
  text-align: center;
}
.cta-band h3 { margin: 0 0 10px; font-size: 28px; font-weight: 900; letter-spacing: -.2px; }
.cta-band p {
  margin: 0 auto 26px;
  color: rgba(255,255,255,.85);
  font-weight: 600;
  max-width: 560px;
  font-size: 15px;
  line-height: 1.6;
}
.cta-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ─── Buttons (used in CTA bands and inline) ──────────── */
.btn-join,.btn-primary,.btn-outline{
  background:#3e79b8;
  color:#fff;
  padding:10px 25px;
  border-radius:5px;
  border:1px solid rgba(255,255,255,.22);
  font-weight:700;
  font-size:14px;
  cursor:pointer;
  transition:transform .12s ease,box-shadow .12s ease,background .12s ease;
}
.btn-join:hover,.btn-primary:hover{
  transform:translateY(-1px);
  box-shadow:0 14px 30px rgba(0,0,0,.28);
  background:#3a7bc8;
}

.btn-outline:hover{
  background:rgba(255,255,255,.08);
  border-color:rgba(255,255,255,.55);
}

.btn-primary svg{ flex:0 0 auto; }

.btn-ghost {
  border: 1px solid rgba(255,255,255,.22);
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.08));
  color: #fff;
  padding: 13px 22px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(0,0,0,.20);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-ghost:hover { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(0,0,0,.26); }

/* ─── Footer ──────────────────────────────────────────── */
footer {
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0)),
    linear-gradient(90deg, var(--nav-1), var(--nav-2));
  color: #fff;
  border-top: 1px solid rgba(255,255,255,.10);
}
.footer-inner {
  padding: 34px 0 18px;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 26px;
}
.footer-title { margin: 0 0 10px; font-weight: 900; letter-spacing: .2px; }
.footer-text { margin: 0; color: rgba(255,255,255,.84); line-height: 1.55; font-weight: 600; font-size: 13.5px; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.footer-links a { color: rgba(255,255,255,.86); font-weight: 700; font-size: 13.5px; }
.footer-links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.10);
  padding: 14px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255,255,255,.78);
  font-weight: 600;
  font-size: 12.5px;
}

/* ─── Hamburger button ────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px; height: 42px;
  background: none;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: #fff;
  border-radius: 999px;
  transition: transform .25s ease, opacity .25s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Side drawer ─────────────────────────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99;
  opacity: 0;
  transition: opacity .25s ease;
}
.nav-overlay.visible { opacity: 1; }
.side-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(320px, 85vw);
  height: 100%;
  background: linear-gradient(160deg, #0f2235, #1a3a5c);
  z-index: 100;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 30px rgba(0,0,0,.35);
}
.side-drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.drawer-brand { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: .2px; }
.drawer-close { background: none; border: none; cursor: pointer; color: rgba(255,255,255,.7); font-size: 24px; line-height: 1; padding: 4px 8px; }
.drawer-close:hover { color: #fff; }
.drawer-menu { list-style: none; margin: 0; padding: 18px 0; flex: 1; overflow-y: auto; }
.drawer-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 24px;
  color: rgba(255,255,255,.88);
  font-weight: 600;
  font-size: 16px;
  border-left: 3px solid transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.drawer-menu li a:hover,
.drawer-menu li a.active { background: rgba(105,168,232,.12); border-left-color: var(--accent); color: #fff; }
.drawer-footer { padding: 20px 22px; border-top: 1px solid rgba(255,255,255,.10); }
.drawer-footer .btn-join { width: 100%; text-align: center; display: block; }

/* ─── Responsive base ─────────────────────────────────── */
@media (max-width: 1111px) {
  .hamburger { display: flex; }
  .nav { height: auto; padding: 14px 0; }
  nav[aria-label="Primary"] { display: none; }
  .nav-cta { display: none; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .footer-inner { grid-template-columns: 1fr; }
  .cta-actions { flex-direction: column; align-items: center; }
}
