:root {
  --bg: #ffffff;
  --bg-soft: #f7f9fc;
  --ink: #12263a;
  --ink-dim: #4b657a;
  --accent: #0f9d58;
  --accent-2: #f59e0b;
  --danger: #c62828;
  --line: rgba(15, 42, 67, 0.16);
  --card: rgba(255, 255, 255, 0.9);
  --shadow: 0 14px 35px rgba(13, 39, 66, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 52%, #f5f9ff 100%);
}

.sunrise-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: #ffffff;
}

.sunrise-glow {
  display: none;
}

.sunrise-image {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(72vw, 780px);
  height: auto;
  transform: translate(-50%, 82vh) scale(0.78);
  opacity: 0.1;
  filter: none;
  animation:
    sunriseRiseMove 4.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s 1 forwards,
    sunriseFadeIn 4.8s linear 0.2s 1 forwards;
}

/* L'alba deve far avanzare insieme posizione e opacita. */
@keyframes sunriseRiseMove {
  0% {
    transform: translate(-50%, 82vh) scale(0.78);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes sunriseFadeIn {
  0% {
    opacity: 0.1;
  }
  100% {
    opacity: 1;
  }
}

.sunrise-image.is-settled {
  transform: translate(-50%, -50%) scale(1);
  animation: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 0.8rem;
  min-height: 198px;
  padding: 0.7rem clamp(1rem, 3vw, 2.8rem);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-logo {
  width: clamp(108px, 15vw, 180px);
  height: auto;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.brand-kicker {
  margin: 0;
  color: var(--accent);
  font-size: clamp(0.74rem, 1.4vw, 0.92rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-sub {
  margin: 0;
  color: var(--ink-dim);
  font-size: clamp(0.8rem, 1.55vw, 1rem);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  justify-self: end;
  flex-wrap: wrap;
}

.top-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  justify-items: center;
  gap: clamp(0.65rem, 1.8vw, 1.4rem);
  width: min(820px, 100%);
  height: 122px;
  justify-self: center;
  align-self: end;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.38s ease, transform 0.38s ease, visibility 0.38s ease;
}

.top-stats.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.language-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

#languageSelect {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.38rem 0.85rem;
  background: #ffffff;
  color: var(--ink);
  font-weight: 600;
}

.toolbar-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.95rem;
  color: #103758;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 255, 0.98));
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(12, 44, 78, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.toolbar-chip:hover,
.toolbar-chip:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(12, 44, 78, 0.14);
  border-color: rgba(16, 55, 88, 0.28);
  outline: none;
}

.audio-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.9rem;
  color: var(--ink);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.audio-btn .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-2);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.55);
}

.audio-btn[aria-pressed="true"] .dot {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(15, 157, 88, 0.55);
}

.documentation-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
}

.documentation-modal.is-open {
  display: block;
}

.documentation-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 25, 41, 0.56);
  backdrop-filter: blur(6px);
}

.documentation-dialog {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 95vw;
  height: 95vh;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-rows: auto 1fr;
  background: #ffffff;
  border: 1px solid rgba(17, 57, 92, 0.16);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(6, 22, 38, 0.28);
  overflow: hidden;
}

.documentation-dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid rgba(15, 42, 67, 0.12);
  background: linear-gradient(180deg, #fbfdff 0%, #f2f7fb 100%);
}

.documentation-title {
  margin: 0;
  font-family: "Lora", serif;
  font-size: clamp(1.05rem, 1.7vw, 1.4rem);
  color: #12304d;
}

.documentation-close {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(17, 57, 92, 0.16);
  border-radius: 999px;
  background: #ffffff;
  color: #103758;
  font-size: 1.7rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(12, 44, 78, 0.08);
}

.documentation-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

body.modal-open {
  overflow: hidden;
}

.scroll-cue {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  width: 78px;
  height: 78px;
  border-radius: 999px;
  border: 2px solid rgba(17, 57, 92, 0.32);
  background: rgba(255, 255, 255, 0.92);
  color: #11395c;
  display: grid;
  place-items: center;
  transform: translate(-50%, 12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: 0 12px 22px rgba(17, 57, 92, 0.14);
}

.scroll-cue.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: cueBounce 1.28s ease-in-out infinite;
}

.scroll-cue-arrow {
  display: inline-block;
  font-size: 2.35rem;
  line-height: 1;
  transform: translateY(-2px);
}

@keyframes cueBounce {
  0% {
    transform: translate(-50%, 0) scale(1, 1);
  }
  18% {
    transform: translate(-50%, 8px) scale(1.06, 0.94);
  }
  42% {
    transform: translate(-50%, -16px) scale(0.98, 1.03);
  }
  62% {
    transform: translate(-50%, 0) scale(1, 1);
  }
  100% {
    transform: translate(-50%, 0) scale(1, 1);
  }
}

.free-strip {
  position: relative;
  z-index: 15;
  width: min(1220px, calc(100% - 2rem));
  margin: 0.75rem auto 0;
  padding: 0.95rem 1.05rem;
  border: 1px solid #8ca9c2;
  border-radius: 14px;
  background: linear-gradient(130deg, #f7fbff, #f2f8ff);
  box-shadow: 0 8px 18px rgba(13, 39, 66, 0.08);
  text-align: center;
}

.free-strip-title {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #1e3a56;
  font-size: clamp(1rem, 2vw, 1.3rem);
  text-transform: uppercase;
}

.free-strip-subtitle {
  margin: 0.35rem 0 0;
  color: #37546f;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
}

main {
  position: relative;
  z-index: 10;
  padding: 0 clamp(1rem, 3vw, 2.8rem) 4rem;
}

.hero {
  position: relative;
  min-height: calc(100vh - 120px);
  display: grid;
  align-items: end;
  grid-template-columns: 1fr;
  gap: 0;
  padding-block: clamp(2rem, 8vh, 5rem);
}

.hero-inner {
  position: relative;
  z-index: 12;
  max-width: min(940px, 92%);
  margin-inline: auto;
  text-align: center;
}

.hero-inner h1 {
  margin: 0;
  font-family: "Lora", serif;
  line-height: 1.08;
  text-wrap: balance;
  font-size: clamp(2rem, 5vw, 4.1rem);
}

.hero-subtitle {
  margin-top: 1rem;
  color: var(--ink-dim);
  font-size: clamp(1rem, 1.7vw, 1.23rem);
  max-width: 70ch;
  line-height: 1.58;
  margin-inline: auto;
  text-align: center;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.45rem;
  justify-content: center;
}

.btn {
  text-decoration: none;
  border-radius: 999px;
  padding: 0.68rem 1.15rem;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(100deg, #157347, var(--accent));
}

.btn-ghost {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.stat-card {
  position: relative;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  width: fit-content;
  min-height: 0;
  user-select: none;
  pointer-events: auto;
  cursor: default;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.stat-card:hover,
.stat-card.is-active {
  z-index: 13;
}

.stat-card .value {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.35rem, 2.25vw, 2rem);
  color: #11395c;
  text-shadow: 0 4px 10px rgba(17, 57, 92, 0.13);
  text-align: center;
  display: inline-block;
  padding: 0;
}

.stat-card .label {
  display: none;
}

.stat-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 24px);
  top: auto;
  width: clamp(320px, 30vw, 460px);
  min-height: 82px;
  overflow: visible;
  border: 1px solid rgba(16, 55, 88, 0.28);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.97), rgba(244, 251, 255, 0.97));
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(13, 39, 66, 0.14);
  padding: 0.68rem 0.86rem;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.stat-card:hover .stat-popover,
.stat-card.is-active .stat-popover {
  opacity: 1;
  transform: translate(-50%, 0);
}

.top-stats .stat-card:first-child .stat-popover {
  left: 0;
  transform: translate(0, 4px);
}

.top-stats .stat-card:first-child:hover .stat-popover,
.top-stats .stat-card:first-child.is-active .stat-popover {
  transform: translate(0, 0);
}

.top-stats .stat-card:last-child .stat-popover {
  left: auto;
  right: 0;
  transform: translate(0, 4px);
}

.top-stats .stat-card:last-child:hover .stat-popover,
.top-stats .stat-card:last-child.is-active .stat-popover {
  transform: translate(0, 0);
}

.stat-popover-title {
  margin: 0;
  font-weight: 800;
  font-size: 0.98rem;
  color: #143654;
}

.stat-popover-text {
  margin: 0.32rem 0 0;
  color: #2f4b63;
  line-height: 1.4;
  font-size: 0.92rem;
}

.section {
  padding-block: clamp(2rem, 7vw, 4rem);
  width: min(1220px, 100%);
  margin-inline: auto;
  text-align: center;
}

.section-head h2 {
  margin: 0;
  font-family: "Lora", serif;
  font-size: clamp(1.45rem, 3.5vw, 2.6rem);
  text-align: center;
}

.section-head p {
  margin: 0.85rem 0 0;
  color: #2f4b63;
  font-size: clamp(1.05rem, 1.55vw, 1.22rem);
  max-width: 74ch;
  line-height: 1.66;
  text-align: center;
  margin-inline: auto;
}

.icon-ribbon {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  justify-content: center;
  align-items: stretch;
  gap: 0.95rem;
  width: min(980px, 100%);
  margin-inline: auto;
}

.icon-chip {
  display: grid;
  grid-template-rows: 132px auto;
  align-items: start;
  justify-items: center;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(14, 42, 68, 0.08);
  padding: 0.75rem 0.55rem 0.65rem;
  transition: transform 0.25s ease;
}

.icon-chip:hover {
  transform: translateY(-4px) scale(1.02);
}

.icon-chip img {
  max-width: 122px;
  max-height: 122px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.icon-caption {
  margin: 0.5rem 0 0;
  text-align: center;
  color: #25465f;
  font-size: 0.83rem;
  line-height: 1.32;
  font-weight: 600;
}

.cards-grid,
.standard-grid {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
  width: min(1160px, 100%);
  margin-inline: auto;
}

.card,
.standard-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  min-height: 190px;
  box-shadow: var(--shadow);
  transform-style: preserve-3d;
}

.block-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 0.72rem;
  align-items: center;
  justify-items: center;
}

.block-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: saturate(1.05) contrast(1.02);
}

.block-copy h3 {
  margin: 0;
  text-align: center;
}

.block-copy p {
  margin: 0.55rem 0 0;
  text-align: center;
}

.card h3,
.standard-card h3 {
  margin: 0;
  font-size: 1.03rem;
  color: #12304d;
  text-align: center;
}

.card p,
.standard-card p {
  margin: 0.55rem 0 0;
  color: var(--ink-dim);
  line-height: 1.52;
  text-align: center;
}

.timeline {
  margin-top: 1.2rem;
  display: grid;
  gap: 0.85rem;
  width: min(980px, 100%);
  margin-inline: auto;
}

.timeline-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  padding: 0.85rem;
  box-shadow: 0 8px 20px rgba(11, 40, 68, 0.08);
  justify-items: center;
  text-align: center;
}

.timeline-step {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(130deg, #22c55e, #86efac);
  color: #0b2a1f;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.timeline-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.timeline-content h3 {
  margin: 0;
  font-size: 1.05rem;
  text-align: center;
}

.timeline-content p {
  margin: 0.35rem 0 0;
  color: var(--ink-dim);
  line-height: 1.52;
  text-align: center;
}

.footer {
  padding: 1.5rem clamp(1rem, 3vw, 2.8rem) 2.2rem;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.footer p {
  margin: 0;
  color: #466176;
  font-size: 0.9rem;
  line-height: 1.52;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
}

@media (max-width: 1080px) {
  .hero {
    align-items: start;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 0.58rem;
    min-height: 220px;
  }

  .top-actions {
    justify-self: center;
  }

  .top-stats {
    width: 100%;
    max-width: 680px;
    gap: 0.62rem;
    height: 126px;
  }

  .stat-card .value {
    font-size: clamp(1.2rem, 2.9vw, 1.58rem);
  }

  .stat-popover {
    width: clamp(280px, 48vw, 390px);
    min-height: 78px;
    bottom: calc(100% - 16px);
  }

  .cards-grid,
  .standard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .block-row {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .block-icon {
    width: 42px;
    height: 42px;
  }

  .icon-ribbon {
    grid-template-columns: repeat(4, minmax(128px, 1fr));
    width: min(860px, 100%);
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 252px;
    padding-inline: 0.72rem;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  .documentation-dialog {
    width: calc(100vw - 1rem);
    height: calc(100vh - 1rem);
    border-radius: 18px;
  }

  .brand-copy {
    text-align: center;
  }

  .cards-grid,
  .standard-grid {
    grid-template-columns: 1fr;
  }

  .top-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: 132px;
    max-width: 420px;
    gap: 0.5rem 0.7rem;
  }

  .stat-card {
    width: fit-content;
    min-height: 0;
  }

  .stat-card .value {
    font-size: clamp(1.08rem, 5vw, 1.34rem);
  }

  .icon-chip {
    grid-template-rows: 114px auto;
  }

  .icon-ribbon {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    width: min(460px, 100%);
  }

  .icon-chip img {
    max-width: 102px;
    max-height: 102px;
  }

  .stat-popover {
    width: min(88vw, 360px);
    min-height: 72px;
    bottom: calc(100% - 12px);
    top: auto;
  }

  .scroll-cue {
    width: 68px;
    height: 68px;
    bottom: 18px;
  }

  .scroll-cue-arrow {
    font-size: 2.05rem;
  }

  .top-stats .stat-card:nth-child(odd) .stat-popover {
    left: 0;
    transform: translate(0, 4px);
  }

  .top-stats .stat-card:nth-child(odd):hover .stat-popover,
  .top-stats .stat-card:nth-child(odd).is-active .stat-popover {
    transform: translate(0, 0);
  }

  .top-stats .stat-card:nth-child(even) .stat-popover {
    left: auto;
    right: 0;
    transform: translate(0, 4px);
  }

  .top-stats .stat-card:nth-child(even):hover .stat-popover,
  .top-stats .stat-card:nth-child(even).is-active .stat-popover {
    transform: translate(0, 0);
  }

  .free-strip {
    margin-inline: 0.8rem;
  }
}
