/* ============================================================================
   InterCity-Hubs — Pagine portale (landing, scenari, legali)
   Material / Google (dark). Condiviso da index.php, scenarios.php.
   ========================================================================== */

:root {
  --bg:        #131314;
  --surface:   #1e1f20;
  --surface-1: #28292a;
  --surface-2: #303134;
  --surface-3: #3c4043;
  --border:        #444746;
  --border-subtle: #2d2e30;
  --text:  #e3e3e3;
  --text-2:#c4c7c5;
  --muted: #9aa0a6;
  --primary:        #8ab4f8;
  --primary-strong: #1a73e8;
  --primary-press:  #4285f4;
  --primary-tint:   rgba(138,180,248,.14);
  --green: #81c995;
  --amber: #fdd663;
  --red:   #f28b82;
  --r:    8px;
  --r-sm: 4px;
  --el-1: 0 1px 2px rgba(0,0,0,.5), 0 1px 3px 1px rgba(0,0,0,.3);
  --el-2: 0 1px 3px rgba(0,0,0,.5), 0 4px 8px 3px rgba(0,0,0,.3);
  --font: 'Roboto', system-ui, "Segoe UI", Arial, sans-serif;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal; font-style: normal; line-height: 1; letter-spacing: normal;
  text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal;
  direction: ltr; -webkit-font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  font-variation-settings: 'opsz' 24, 'wght' 400, 'GRAD' 0, 'FILL' 0;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: var(--font); color: var(--text); -webkit-font-smoothing: antialiased; }
body { background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--primary-tint); }

/* ---------- App bar ---------- */
header.site {
  display: flex; align-items: center; gap: 14px; padding: 12px 24px;
  border-bottom: 1px solid var(--border-subtle); background: var(--surface);
  box-shadow: var(--el-1); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center;
  background: var(--primary-strong); color: #fff;
}
.brand .logo .material-symbols-outlined { font-size: 23px; }
.brand b { font-size: 18px; font-weight: 500; letter-spacing: .2px; }
.brand b .accent { color: var(--primary); font-weight: 700; }
.brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; margin-top: 1px; }
.spacer { flex: 1; }

.topbtn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: transparent;
  color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer; font-family: var(--font);
  transition: background .14s, border-color .14s, color .14s;
}
.topbtn:hover { background: var(--surface-1); color: var(--text); }
.topbtn.primary { background: var(--primary-strong); border-color: transparent; color: #fff; }
.topbtn.primary:hover { background: var(--primary-press); }
.topbtn.lang { padding: 0 12px; min-width: 44px; justify-content: center; font-weight: 700; }
.admin-menu { display: flex; align-items: center; gap: 8px; }
.admin-menu .topbtn { font-size: 12px; padding: 0 12px; background: var(--surface-2); border-color: var(--border-subtle); color: var(--amber); }
.admin-menu .topbtn:hover { background: var(--surface-3); color: var(--text); }
.profile { display: flex; align-items: center; gap: 10px; }
.profile img, .profile .pfallback {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); display: grid; place-items: center; font-size: 16px; border: 1px solid var(--border-subtle);
}
.profile .pname { font-size: 14px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Main ---------- */
main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 56px 24px 36px; }
.hero { text-align: center; margin-bottom: 48px; }
.hero h1 { font-size: clamp(30px, 6vw, 52px); margin: 0 0 14px; line-height: 1.08; font-weight: 500; letter-spacing: -.5px; }
.hero h1 .accent { color: var(--primary); }
.hero p { color: var(--muted); font-size: clamp(15px, 2.4vw, 18px); max-width: 640px; margin: 0 auto; line-height: 1.5; }

/* Testo visibile solo agli screen reader (gerarchia heading / a11y) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Cards ---------- */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 760px) { .modes { grid-template-columns: 1fr; } }
.card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 24px 22px; border-radius: var(--r); border: 1px solid var(--border-subtle);
  background: var(--surface); transition: transform .14s, border-color .14s, box-shadow .14s, background .14s;
}
.card .ico {
  width: 44px; height: 44px; border-radius: var(--r-sm); display: grid; place-items: center;
  background: var(--surface-2); color: var(--primary); margin-bottom: 4px;
}
.card .ico .material-symbols-outlined { font-size: 26px; }
.card h3 { margin: 0; font-size: 19px; font-weight: 500; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; flex: 1; }
.card .cta {
  margin-top: 10px; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 500; font-size: 14px; color: var(--primary);
}
.card.primary:hover {
  transform: translateY(-2px); border-color: var(--border); background: var(--surface-1); box-shadow: var(--el-2);
}
.card.primary:hover .cta { gap: 10px; }
.card.locked { opacity: .9; }
.card.locked .ico { color: var(--muted); }
.card.locked .cta { color: var(--muted); }
.badge {
  position: absolute; top: 16px; right: 16px; font-size: 11px; letter-spacing: .4px; text-transform: uppercase;
  color: var(--amber); border: 1px solid rgba(253,214,99,.32); border-radius: var(--r-sm);
  padding: 3px 9px; background: rgba(253,214,99,.08); font-weight: 500;
}

.note { margin-top: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.note a { color: var(--primary); }

/* ---------- Scenari ---------- */
.page-head h1 { font-size: clamp(24px, 5vw, 38px); margin: 0 0 4px; font-weight: 500; letter-spacing: -.3px; }
.page-head .sub { color: var(--muted); margin: 0 0 28px; }
.guesthint {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border-subtle); color: var(--text-2);
  padding: 12px 16px; border-radius: var(--r); font-size: 14px; margin-bottom: 24px;
}
.guesthint .material-symbols-outlined { color: var(--amber); font-size: 20px; }
.guesthint a { color: var(--primary); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.diff { font-size: 12px; letter-spacing: 2px; white-space: nowrap; }
.diff .d { color: #5f6368; } .diff .d.on { color: var(--amber); }
.modes-row { display: flex; gap: 8px; align-items: center; }
.modes-row .mode-ico { font-size: 24px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.stars .star { color: #5f6368; font-size: 18px; } .stars .star.on { color: var(--amber); }
.play {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 18px;
  border-radius: var(--r-sm); font-weight: 500; font-size: 14px;
  background: var(--primary-strong); color: #fff; transition: background .14s;
}
.play:hover { background: var(--primary-press); }
.best { color: var(--muted); font-size: 12px; font-family: 'Roboto Mono', monospace; }

/* ---------- Campagna ---------- */
.act-head { font-size: 18px; font-weight: 500; letter-spacing: -.2px; margin: 32px 0 16px; color: var(--text-2); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.act-head:first-of-type { margin-top: 8px; }
.act-head.gated { color: var(--muted); }
/* Badge requisito stelle per il salto d'atto (gating) */
.act-gate {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .2px;
  color: var(--amber); background: rgba(253,214,99,.12); border: 1px solid rgba(253,214,99,.35);
}
.act-gate.ok { color: var(--green); background: rgba(129,201,149,.12); border-color: rgba(129,201,149,.35); }
.act-gate .material-symbols-outlined { font-size: 15px; }
.gate-cta { color: var(--amber) !important; border-color: rgba(253,214,99,.35) !important; }
.lvl-num { color: var(--muted); font-weight: 400; }
.region-tag {
  font-size: 11px; font-weight: 500; letter-spacing: .3px; white-space: nowrap;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border-subtle);
  padding: 2px 8px; border-radius: 999px;
}
.card.locked { opacity: .55; filter: saturate(.4); }
.locked-cta {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: var(--r-sm); font-weight: 500; font-size: 14px;
  background: transparent; color: var(--muted); border: 1px solid var(--border-subtle); cursor: default;
}

/* ---------- Footer ---------- */
footer.site { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border-subtle); }
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--primary); }

/* ---------- Mappa campagna (SVG geografico) ---------- */
.camp-map-wrap {
  margin: 0 auto 36px; max-width: 460px;
  background: radial-gradient(120% 90% at 50% 0%, var(--surface-1), var(--surface));
  border: 1px solid var(--border-subtle); border-radius: var(--r); padding: 12px;
}
.camp-map { width: 100%; height: auto; display: block; }
.camp-map .mreg { stroke: var(--border-subtle); stroke-width: .6; transition: fill .2s, opacity .2s; }
.camp-map .mreg.fog { fill: #232425; opacity: .55; }
.camp-map .mreg.act0 { fill: rgba(138,180,248,.16); stroke: rgba(138,180,248,.4); }
.camp-map .mreg.act1 { fill: rgba(129,201,149,.16); stroke: rgba(129,201,149,.4); }
.camp-map .mreg.act2 { fill: rgba(253,214,99,.16);  stroke: rgba(253,214,99,.4); }
.camp-map .mpath { stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 4 4; opacity: .5; }
.camp-map .mpin { cursor: pointer; }
.camp-map .mpin circle {
  fill: var(--surface-2); stroke: var(--ac, var(--primary)); stroke-width: 2.5;
  transition: transform .12s, filter .12s; transform-box: fill-box; transform-origin: center;
}
.camp-map .mpin:hover circle { filter: brightness(1.3); transform: scale(1.18); }
.camp-map .mpin.done circle { fill: var(--ac); }
.camp-map .mpin.locked circle { stroke: var(--border); fill: #2a2b2c; opacity: .7; }
.camp-map .mpin-n { fill: var(--text); font: 700 12px var(--font); text-anchor: middle; pointer-events: none; }
.camp-map .mpin.done .mpin-n { fill: #1a1a1a; }
.camp-map .mpin.locked .mpin-n { fill: var(--muted); }
.camp-map .mpin-star { fill: var(--amber); font-size: 9px; text-anchor: middle; pointer-events: none; }
.camp-map-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.camp-map-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.camp-map-legend .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 1px solid var(--border); }
.camp-map-legend .dot.act0 { background: #8ab4f8; border-color: transparent; }
.camp-map-legend .dot.act1 { background: #81c995; border-color: transparent; }
.camp-map-legend .dot.act2 { background: #fdd663; border-color: transparent; }
.camp-map-legend .dot.done { background: #fdd663; border-color: transparent; }
.camp-map-legend .dot.locked { background: #2a2b2c; }
.camp-map-credit { text-align: center; margin-top: 6px; font-size: 10px; color: var(--muted); opacity: .7; }

@media (max-width: 600px) {
  header.site { padding: 10px 14px; gap: 10px; }
  main { padding: 36px 16px 28px; }
  .brand small { display: none; }
  .camp-map-wrap { max-width: 100%; }
}
