:root {
  --bg: #0a0a0a;
  --fg: #ffffff;
  --sans: 'Satoshi', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
}

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

html, body {
  width: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  padding: clamp(20px, 4vw, 40px);
  position: relative;
  isolation: isolate;
  touch-action: none; /* consente ai pointerevents di triggare su mobile senza scroll */
  overscroll-behavior: none;
}

/* ---------- Header / brand ---------- */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  animation: fadeIn 0.8s ease-out 0.1s forwards;
  position: relative;
  z-index: 3;
}

.brand__logo {
  display: block;
  width: clamp(44px, 6vw, 64px);
  color: var(--fg);
}
.brand__logo svg { display: block; width: 100%; height: auto; }

.brand__name {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(18px, 3vw, 32px);
  padding: clamp(20px, 6vh, 60px) 0;
  position: relative;
  z-index: 3;
  pointer-events: none; /* il mouse passa al canvas sotto */
}
.hero * { pointer-events: auto; }

.hero__title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(3rem, 10.5vw, 5.8rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  max-width: 14ch;
}
.hero__title > span {
  display: block;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(24px);
  animation: riseFocus 1.1s cubic-bezier(.2,.7,.2,1) forwards;
}
.hero__title > span:nth-child(1) { animation-delay: 0.35s; }
.hero__title > span:nth-child(2) { animation-delay: 0.55s; }
.hero__title > span > span { display: inline-block; will-change: transform; }

.hero__tag {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 4.5vw, 2.3rem);
  letter-spacing: 0.01em;
  opacity: 0;
  animation: fadeToTag 1.2s ease-out 1.1s forwards;
}
@keyframes fadeToTag { to { opacity: 0.7; } }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding-top: clamp(16px, 2.5vw, 24px);
  position: relative;
  z-index: 3;
  opacity: 0;
  animation: fadeIn 0.8s ease-out 1.6s forwards;
}
.site-footer a {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 0.3s ease;
}
.site-footer a:hover,
.site-footer a:focus-visible { opacity: 1; }
.site-footer__location {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg);
  opacity: 0.4;
  margin: 8px 0 0;
}

/* ---------- Background floating words (JS-driven) ---------- */
.bg-words {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-words span {
  position: absolute;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--fg);
  opacity: 0;
  white-space: nowrap;
  letter-spacing: 0.02em;
  will-change: transform, opacity;
  transition: opacity 0.35s ease-out;
}
.bg-words.ready span { opacity: var(--o, 0.2); }

/* ---------- Bit rain canvas ---------- */
#bitrain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Animations ---------- */
@keyframes fadeIn { to { opacity: 1; } }
@keyframes riseFocus {
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

/* Respect user preferences */
@media (prefers-reduced-motion: reduce) {
  .brand,
  .hero__title span,
  .hero__tag,
  .bg-words span {
    animation: none !important;
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
  .hero__tag { opacity: 0.7 !important; }
  .bg-words span { opacity: var(--o, 0.14) !important; }
  #bitrain { display: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .hero__title { font-size: clamp(3rem, 14vw, 4.2rem); }
  .bg-words span { font-size: clamp(1.6rem, 7vw, 2.4rem) !important; }
}
