/* ==========================================================================
   Base: reset, tipografia, layout, header/nav/footer, tab-bar mobile.
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  color: var(--c-testo);
  background: var(--c-sfondo);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 500; line-height: 1.2; color: var(--c-testo); }
h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.01em; }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 20px; }

a { color: var(--c-oro); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.serif { font-family: var(--font-serif); }
.muted { color: var(--c-muted); }
.micro-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--c-muted-ch);
}

/* ---- Layout container ---- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-5);
}

.page {
  flex: 1 0 auto;
  padding: var(--sp-6) 0 calc(var(--tabbar-h) + var(--sp-6));
}
@media (min-width: 860px) {
  .page { padding-bottom: var(--sp-7); }
}

/* ---- Header brandizzato ---- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(238, 242, 248, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--c-bordo-sc);
}
.site-header__inner {
  min-height: var(--nav-h);
  padding-top: var(--sp-2); padding-bottom: var(--sp-2);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--c-primario);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); flex: none;
}
.brand__logo span {
  font-family: var(--font-serif); color: var(--c-chiaro);
  font-size: 24px; margin-top: -2px;
}
.brand__name { font-family: var(--font-serif); font-size: 22px; color: var(--c-testo); letter-spacing: -0.01em; white-space: nowrap; }
.brand__sub {
  display: none; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--c-muted-chiaro); border-left: 1px solid var(--c-bordo-sc);
  padding-left: var(--sp-3); margin-left: var(--sp-1);
}
@media (min-width: 1180px) { .brand__sub { display: inline; } }

/* ---- Top-nav desktop ---- */
.topnav { display: none; align-items: center; gap: 2px; }
@media (min-width: 860px) { .topnav { display: flex; } }
.topnav__link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--r-pill);
  color: var(--c-muted); font-size: 14px; font-weight: 500;
  white-space: nowrap; flex: none;
}
.topnav__link i { font-size: 17px; }
.topnav__link:hover { background: var(--c-sfondo-scuro); color: var(--c-testo); text-decoration: none; }
.topnav__link.is-active { background: var(--c-primario); color: var(--c-chiaro); }

.header-actions { display: flex; align-items: center; gap: var(--sp-3); }
.header-actions .utente { display: none; font-size: 13px; color: var(--c-muted); }
@media (min-width: 720px) { .header-actions .utente { display: inline; } }

/* ---- Tab-bar mobile ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--c-card);
  border-top: 1px solid var(--c-bordo);
  display: flex; align-items: stretch; justify-content: space-around;
}
@media (min-width: 860px) { .tabbar { display: none; } }
.tabbar__link {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--c-muted-ch); font-size: 10px; font-weight: 600;
  letter-spacing: 0.02em; text-decoration: none;
}
.tabbar__link i { font-size: 22px; }
.tabbar__link.is-active { color: var(--c-oro); }
.tabbar__link:hover { text-decoration: none; }

/* ---- Footer brandizzato ---- */
.site-footer {
  flex: none;
  border-top: 1px solid var(--c-bordo-sc);
  background: var(--c-sfondo-scuro);
  padding: var(--sp-6) 0 calc(var(--tabbar-h) + var(--sp-6));
  margin-top: var(--sp-7);
  color: var(--c-muted);
  font-size: 13px;
}
@media (min-width: 860px) { .site-footer { padding-bottom: var(--sp-6); } }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: space-between; align-items: center; }

/* ---- Intestazione pagina ---- */
.page-head { margin-bottom: var(--sp-6); }
.page-head__eyebrow { margin-bottom: var(--sp-2); }
.page-head__intro { color: var(--c-testo-soft); font-family: var(--font-serif); font-size: clamp(18px, 2.4vw, 22px); max-width: 720px; margin-top: var(--sp-3); }

/* Utility responsive */
.grid { display: grid; gap: var(--sp-4); }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.stack > * + * { margin-top: var(--sp-4); }
.flex { display: flex; gap: var(--sp-3); align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.text-center { text-align: center; }
.hidden { display: none !important; }
