/* =========================================================================
   BASE — reset, tipografia, layout della app-shell.
   ========================================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(34,224,214,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(109,123,255,0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  overflow-x: hidden;
}

h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
a { color: inherit; }
button, select, input { font-family: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.hide { display: none !important; }
.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; }

/* ---------- footer SEO ---------- */
.site-foot {
  border-top: 1px solid var(--border);
  padding: var(--sp-5) var(--sp-5) calc(var(--tabbar-h) + var(--sp-5));
  margin-top: var(--sp-5);
}
.foot-in { max-width: 1000px; margin: 0 auto; color: var(--muted); font-size: 13px; line-height: 1.6; }
.foot-in strong { color: var(--text); }
.foot-kw { margin-top: var(--sp-2); }
.foot-links { margin-top: var(--sp-3); }
.foot-links a { color: var(--accent); text-decoration: none; font-weight: 600; }
.foot-links a:hover { text-decoration: underline; }
.foot-copy { margin-top: var(--sp-3); color: var(--faint); font-size: 12px; }

/* ---------- shell ---------- */
.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

/* ---------- header ---------- */
.hd {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  min-height: var(--header-h);
  background: linear-gradient(180deg, var(--bg-2), transparent);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border);
}
.hd-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.hd-logo .glyph {
  font-size: 28px; line-height: 1; color: var(--accent);
  text-shadow: 0 0 14px var(--accent-glow);
}
.hd-logo .name { font-weight: 900; font-size: 18px; letter-spacing: -0.03em; }
.hd-logo .name small { display: block; font-size: 10px; font-weight: 600; color: var(--faint); letter-spacing: 0.06em; }

.hd-nav { display: flex; gap: 4px; margin-left: var(--sp-4); }
.hd-spacer { flex: 1; }
.hd-tools { display: flex; align-items: center; gap: var(--sp-2); }

/* segmented control (modalità, lingua) */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px; }
.seg button { padding: 5px 12px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; color: var(--muted); transition: .15s; }
.seg button.on { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-glow); }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center;
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); font-size: 16px; transition: .15s;
}
.icon-btn:hover { border-color: var(--border-2); transform: translateY(-1px); }

/* ---------- main ---------- */
.main { flex: 1; width: 100%; max-width: 1680px; margin: 0 auto; padding: var(--sp-4) var(--sp-5); }

/* ---------- bottom tab bar (mobile) ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: none;
  background: var(--bg-2);
  backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--border);
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); font-size: 10px; font-weight: 700;
}
.tabbar button .ic { font-size: 20px; }
.tabbar button.on { color: var(--accent); }

@media (max-width: 760px) {
  .hd-nav { display: none; }
  .tabbar { display: flex; }
  .main { padding: var(--sp-3); }
}
