/* ==========================================================================
   Base, Reset, Tipografia, Atmosfera & Accessibilità
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 18px);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.56;
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--accent-deep);
  color: var(--text-primary);
  border: 1px solid var(--accent-bright);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--t-fast);
}

.skip-link:focus {
  top: 16px;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.028em;
}

h1 {
  font-size: var(--text-4xl);
  font-weight: 800;
  letter-spacing: -0.036em;
  line-height: 1.07;
}

.h1-accent {
  background: linear-gradient(120deg, #f5f3fb 18%, #d8b4fe 55%, #a855f7 100%);
  background-size: 180% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: textShimmer 8s ease-in-out infinite alternate;
}

@keyframes textShimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); line-height: 1.24; }
p { margin: 0; color: var(--text-secondary); }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
code, pre, .mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
strong { color: var(--text-primary); font-weight: 700; }

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: rgba(168, 85, 247, 0.34);
  color: var(--text-primary);
}

.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;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
