/* La giostra dei cavalli */
:root {
  --fondo: #15132B;
  --alone: #2E2547;
  --testo: #F6EBDD;
  --tenue: #B4ABC8;
  --rosso: #D8443B;
  --rosso-scuro: #9E2A2A;
  --crema: #F6E7CF;
  --oro: #E9B949;
  --oro-chiaro: #FBE3A2;
  --oro-scuro: #A97A26;
  --verde: #2F8F8A;
  --blu: #3E6FB0;
  --rosa: #E58AA6;
  --colonna: #8E2C3A;
  --colonna-scura: #4E1822;
  --specchio: #7F9FBB;
  --specchio-chiaro: #DCE8F0;
  --pavimento: #B9774A;
  --pavimento-scuro: #7A4A2C;
  --lampadina: #FFE7A8;
  --lampadina-spenta: #6A5A4A;
  --margine: clamp(18px, 4vw, 64px);
  --alto: 100vh;
}
@supports (height: 100svh) {
  :root { --alto: 100svh; }
}

* { box-sizing: border-box; }
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  overflow: hidden;
}

.banco {
  position: relative;
  height: var(--alto);
  display: grid;
  grid-template-columns: minmax(280px, 34%) 1fr;
  align-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse 60% 70% at 66% 52%, var(--alone), transparent 70%), var(--fondo);
}

/* ---- il testo del luna park ---- */
.testo {
  position: relative;
  z-index: 2;
  padding: 0 0 0 var(--margine);
  max-width: 420px;
}
.marchio {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--oro);
}
.titolo {
  margin: 0;
  font-size: clamp(32px, 4.2vw, 60px);
  line-height: 1.02;
  font-weight: 700;
  font-stretch: 92%;
  letter-spacing: -0.02em;
}
.frase {
  margin: 20px 0 30px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--tenue);
  max-width: 34ch;
}

/* il pulsante: la pillola si gonfia con un rimbalzo e il ferro di cavallo dondola */
.velocita {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px 14px 18px;
  border: 0;
  background: none;
  color: var(--fondo);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  font-stretch: 100%;
  cursor: pointer;
  transition: font-stretch 0.5s cubic-bezier(0.34, 1.8, 0.5, 1);
  -webkit-tap-highlight-color: transparent;
}
.velocita__fondo {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--oro);
  transition: transform 0.6s cubic-bezier(0.34, 1.8, 0.5, 1), background-color 0.3s;
}
.velocita__ferro,
.velocita__scritta { position: relative; }
.velocita__scritta { display: inline-block; min-width: 9.6em; text-align: left; }
[data-nome-velocita] { display: inline-block; }
.velocita__ferro {
  width: 20px;
  height: 20px;
  transform-origin: 50% 20%;
  transition: transform 0.7s cubic-bezier(0.34, 1.8, 0.5, 1);
}
.velocita:active .velocita__fondo { transform: scale(0.94); transition-duration: 0.12s; }
.velocita:focus-visible { outline: none; }
.velocita:focus-visible .velocita__fondo { box-shadow: 0 0 0 3px var(--fondo), 0 0 0 5px var(--oro-chiaro); }
.velocita--scatta .velocita__ferro { animation: ferro 0.8s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes ferro {
  0% { transform: rotate(0); }
  30% { transform: rotate(-26deg); }
  60% { transform: rotate(14deg); }
  100% { transform: rotate(0); }
}
@media (hover: hover) {
  .velocita:hover { font-stretch: 112%; }
  .velocita:hover .velocita__fondo { transform: scale(1.06, 1.12); background-color: var(--oro-chiaro); }
  .velocita:hover .velocita__ferro { transform: rotate(180deg); }
}

/* ---- la scena ---- */
.palco {
  position: relative;
  height: 100%;
  min-height: 0;
}
.scena {
  position: absolute;
  inset: 4% 2% 4% 0;
  width: 98%;
  height: 92%;
  overflow: visible;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ombra { fill: rgba(0, 0, 0, 0.42); }
.oro { fill: var(--oro); }
.oro-chiaro { fill: var(--oro-chiaro); }
.oro-scuro { fill: var(--oro-scuro); }

/* il tetto */
.tetto { fill: var(--crema); }
.striscia { fill: var(--rosso); }
.smerlo { fill: var(--rosso); stroke: var(--oro); stroke-width: 1.6; stroke-linejoin: round; }
.smerlo--chiaro { fill: var(--crema); }
.orlo-tetto { fill: none; stroke: var(--oro); stroke-width: 5; stroke-linecap: round; }
.lampadina__vetro { fill: var(--lampadina-spenta); stroke: var(--oro-scuro); stroke-width: 1.4; transition: fill 0.25s; }
.lampadina__luce { fill: #fff; opacity: 0.25; transition: opacity 0.25s; }
.lampadina--accesa .lampadina__vetro { fill: var(--lampadina); }
.lampadina--accesa .lampadina__luce { opacity: 0.9; }
.asta { stroke: var(--oro); stroke-width: 3; stroke-linecap: round; }
.bandiera { fill: var(--rosso); stroke: var(--rosso-scuro); stroke-width: 1; stroke-linejoin: round; }

/* la colonna */
.specchio { stroke: var(--oro); stroke-width: 2; }
.specchio__luce { fill: #fff; }

/* la piattaforma */
.piatto-sotto { fill: var(--rosso-scuro); }
.pannello { fill: var(--rosso); stroke: var(--oro); stroke-width: 1.4; }
.pannello--oro { fill: var(--crema); }
.pavimento { fill: var(--pavimento); }
.pavimento-orlo { fill: none; stroke: var(--oro); stroke-width: 2; opacity: 0.7; }
.asse { stroke: var(--pavimento-scuro); stroke-width: 1.6; opacity: 0.55; }

/* i cavalli e i pali tortili */
.palo { stroke: var(--oro); stroke-linecap: round; }
.palo__spire { fill: none; stroke: var(--oro-scuro); stroke-linecap: round; }
.c-manto { fill: var(--manto); stroke: #2A1F2E; stroke-width: 1.6; stroke-linejoin: round; }
.c-gamba { fill: none; stroke: var(--manto); stroke-width: 6.5; stroke-linecap: round; stroke-linejoin: round; }
.c-criniera { fill: none; stroke: var(--oro); stroke-width: 6; stroke-linecap: round; }
.c-sella { fill: var(--sella); stroke: #2A1F2E; stroke-width: 1.4; stroke-linejoin: round; }
.c-orlo { fill: none; stroke: var(--oro); stroke-width: 2; stroke-linecap: round; }
.c-redini { fill: none; stroke: var(--oro); stroke-width: 2; stroke-linecap: round; }
.c-anello { fill: var(--oro-chiaro); stroke: var(--oro-scuro); stroke-width: 1.2; }

/* ---- telefono e finestre strette: il testo sopra, la giostra sotto ---- */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .banco {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    align-items: stretch;
    background: radial-gradient(ellipse 90% 50% at 50% 66%, var(--alone), transparent 70%), var(--fondo);
  }
  .testo {
    padding: calc(var(--margine) + 10px) var(--margine) 0;
    max-width: none;
  }
  .marchio { margin-bottom: 12px; }
  .titolo { font-size: clamp(30px, 8.6vw, 52px); }
  .frase { margin: 12px 0 18px; font-size: 15px; }
  .scena { inset: 2% 0 4%; width: 100%; height: 94%; }
}

/* movimento ridotto: il pulsante cambia solo colore */
@media (prefers-reduced-motion: reduce) {
  .velocita,
  .velocita__fondo,
  .velocita__ferro { transition: background-color 0.3s; }
  .velocita:active .velocita__fondo { transform: none; }
  @media (hover: hover) {
    .velocita:hover .velocita__fondo,
    .velocita:hover .velocita__ferro { transform: none; }
  }
  .velocita--scatta .velocita__ferro { animation: none; }
  @media (hover: hover) {
    .velocita:hover { font-stretch: 100%; }
  }
}
