/* Fonts self-hosted (no requests to Google, GDPR-friendly). Latin subset, includes Italian accents. */
@font-face {
  font-family: "Bangers";
  src: url(fonts/bangers.woff2) format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url(fonts/nunito.woff2) format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --red: #d32f2f; /* darker red: white text on it passes WCAG AA */
  --cream: #fff7d6;
  --blue: #1f4fa8;
  --yellow: #ffd23f;
  --ink: #111;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } /* no iOS font inflation in landscape */
img, svg { max-width: 100%; }

body {
  margin: 0;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  line-height: 1.6;
  overflow-wrap: break-word; /* long emails/links never cause horizontal scroll */
}

h1, h2 {
  font-family: "Bangers", Impact, "Arial Black", sans-serif;
  font-weight: normal;
  letter-spacing: 2px;
}

h3 { font-size: 1.4rem; color: var(--blue); margin: 2.5rem 0 1rem; }

a { color: var(--blue); }

.btn, button {
  display: inline-block;
  padding: .6em 1.4em;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
}
.btn { background: var(--yellow); }

/* Hero */
.hero {
  background:
    radial-gradient(rgba(0,0,0,.15) 1px, transparent 1px) 0 0 / 8px 8px,
    linear-gradient(135deg, var(--red), var(--blue));
  color: #fff;
  min-height: 80vh;
  min-height: 80svh; /* mobile: ignores the collapsing browser toolbar */
  overflow: clip; /* the oversized logo at the start of the punch never causes sideways scroll */
  display: flex;
  flex-direction: column;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
}
nav ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
nav a { display: inline-block; padding: .6rem .3rem; color: #fff; font-weight: bold; text-decoration: none; } /* ~44px tap target */
.brand { display: flex; align-items: center; gap: .5rem; font-size: 1.2rem; }

.hero-text {
  margin: auto;
  text-align: center;
  padding: 2rem;
}
.hero-text h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  margin: 0;
  text-shadow: 4px 4px 0 var(--ink);
}
.hero-text p { font-size: 1.3rem; }
.hero-logo {
  display: block;
  width: min(92vw, 760px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(6px 6px 0 rgba(0, 0, 0, .35));
}

/* Sections */
section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}
/* Alternate full-width background on every other section, no extra markup */
main > section:nth-child(even) {
  background: var(--cream);
  box-shadow: 0 0 0 100vmax var(--cream);
  clip-path: inset(0 -100vmax);
}
section h2 {
  display: inline-block;
  background: var(--yellow);
  padding: .1em .5em;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-1deg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); /* 2 columns on phones */
  gap: 1.5rem;
}
.card {
  margin: 0;
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  background: #fff;
}
.card img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #ddd; }
.card figcaption { padding: .6rem; font-weight: bold; text-align: center; }
.card figcaption span { display: block; font-weight: normal; font-size: .9rem; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 1.5rem;
}
.feature {
  padding: 1.2rem;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 5px 5px 0 var(--ink);
}
.feature svg {
  width: 52px;
  height: 52px;
  padding: 8px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.feature h4 { margin: .6rem 0 .3rem; font-size: 1.15rem; }
.feature p { margin: 0; }

.powers, .steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 1rem;
  padding: 0;
  list-style: none;
}
.powers li, .steps li {
  padding: 1rem;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
}
.powers strong, .steps strong { display: block; color: var(--red); font-size: 1.1rem; }
.powers strong::before { content: "★ "; color: var(--yellow); -webkit-text-stroke: 1px var(--ink); }
.steps { counter-reset: step; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  margin-bottom: .4rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-family: "Bangers", Impact, sans-serif;
  font-size: 1.3rem;
}

.sponsors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}
.sponsors > * {
  display: grid;
  place-items: center;
  width: 180px;
  height: 110px;
  padding: .8rem;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
}
.sponsors img { max-height: 100%; object-fit: contain; }

.events { list-style: none; padding: 0; }
.events li { padding: 1rem; border-left: 6px solid var(--red); margin-bottom: 1rem; background: #fff; }
.events time { display: block; font-weight: bold; color: var(--red); }

.carousel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .5rem;
}
.track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  background: var(--ink);
}
.track li { flex: 0 0 100%; scroll-snap-align: center; }
.track img { display: block; width: 100%; height: clamp(250px, 60vh, 600px); object-fit: contain; }
.carousel button { font-size: 1.6rem; padding: .2em .5em; }

.cta { text-align: center; margin: 2rem 0; }
.btn-big { font-size: 1.3rem; padding: .8em 1.8em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.social { text-align: center; font-weight: bold; }

footer {
  background: var(--ink);
  color: #fff;
  text-align: center;
  padding: 2rem 1rem;
}
footer a { color: var(--yellow); }
.small { font-size: .8rem; opacity: .7; }

#cookie-banner {
  position: fixed;
  left: 1rem; right: 1rem; bottom: 1rem;
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  text-align: center;
}
#cookie-banner[hidden] { display: none; }
#cookie-banner button { margin: 0 .5rem; }

/* Keyboard focus, always visible: blue on light backgrounds, yellow on dark ones */
a:focus-visible, button:focus-visible, .track:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.hero :focus-visible, footer :focus-visible { outline-color: var(--yellow); }

/* Phones */
@media (max-width: 640px) {
  nav { justify-content: center; padding: .75rem 1rem; }
  nav ul { flex-wrap: wrap; justify-content: center; gap: 0 1rem; }
  .brand { width: 100%; justify-content: center; }
  section { padding: 3rem 1rem; }
  .hero-text p { font-size: 1.1rem; }
  .carousel { gap: .25rem; }
  .carousel button { padding: .1em .35em; font-size: 1.3rem; }
  .track img { height: clamp(220px, 50svh, 450px); }
  #cookie-banner { left: .5rem; right: .5rem; bottom: .5rem; }
}

/* Animations: only for users who haven't asked for reduced motion.
   Only transform/opacity (GPU-cheap), no flashing, nothing loops forever. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  .btn, button, .card, .feature, .sponsors a {
    transition: transform .2s ease, box-shadow .2s ease;
  }
  .btn:focus-visible, button:focus-visible {
    transform: translate(-2px, -2px) rotate(-2deg);
    box-shadow: 6px 6px 0 var(--ink);
  }
  /* Hover only on devices that really hover: no "sticky" hover after a tap on phones */
  @media (hover: hover) {
    .btn:hover, button:hover {
      transform: translate(-2px, -2px) rotate(-2deg);
      box-shadow: 6px 6px 0 var(--ink);
    }
    .card:hover, .feature:hover, .sponsors a:hover {
      transform: translateY(-6px) rotate(1deg);
      box-shadow: 10px 10px 0 var(--ink);
    }
  }
  .btn:active, button:active {
    transform: translate(3px, 3px);
    box-shadow: 1px 1px 0 var(--ink);
  }
  .track { scroll-behavior: smooth; }

  /* Hero entrance */
  .hero-text h1:not(.logo) { animation: pop .7s cubic-bezier(.3, 1.6, .5, 1) backwards; }
  /* Logo "punch": hidden until loaded (only if JS runs), then slams in and shakes the hero once */
  .js .hero-logo:not(.pow) { opacity: 0; }
  .hero-logo.pow { animation: punch .7s cubic-bezier(.2, .8, .3, 1) backwards; }
  .hero:has(.pow) { animation: impact .3s .38s ease-out; }
  .hero-text p { animation: rise .6s .4s ease-out backwards; }
  .hero-text .btn { animation: rise .6s .6s ease-out backwards; }
  .brand img { animation: wiggle 1s 1s ease-in-out 2; }

  /* Reveal on scroll, CSS-only; browsers without support just show content */
  @supports (animation-timeline: view()) {
    section h2 {
      animation: pop linear backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
    .card, .events li, .feature, .powers li, .steps li {
      animation: rise linear backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 80%;
    }
  }
}

@keyframes pop {
  from { opacity: 0; transform: scale(.5) rotate(-6deg); }
  to   { opacity: 1; transform: scale(1) rotate(-1deg); }
}
@keyframes punch {
  0%   { opacity: 0; transform: scale(2.6) rotate(-10deg); }
  55%  { opacity: 1; transform: scale(.88) rotate(3deg); }
  72%  { transform: scale(1.07) rotate(-1deg); }
  88%  { transform: scale(.98); }
  100% { transform: none; }
}
@keyframes impact {
  25% { transform: translate(-6px, 4px); }
  50% { transform: translate(5px, -3px); }
  75% { transform: translate(-3px, 2px); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: none; }
}
@keyframes wiggle {
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}
