/**
 * File: static/css/home.css
 * Descrizione: Homepage pubblica RistorApp
 * Scopo: Hero dinamico con logo progressivo e card sequenziali
 */

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  position: relative;

  background-image: url("/static/img/home_bg_soft.png");

  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;

  overflow-x: hidden;
}

.clouds-layer {
  position: fixed;

  top: 0;
  left: 0;

  width: 100%;
  height: 50vh;

  z-index: 1;

  pointer-events: none;

  opacity: 1;

  overflow: hidden;

  mask-image:
    linear-gradient(
      to bottom,
      rgba(0,0,0,1) 0%,
      rgba(0,0,0,0.92) 70%,
      rgba(0,0,0,0) 100%
    );

  -webkit-mask-image:
    linear-gradient(
      to bottom,
      rgba(0,0,0,1) 0%,
      rgba(0,0,0,0.92) 70%,
      rgba(0,0,0,0) 100%
    );
}

.clouds-layer::before,
.clouds-layer::after {
  content: "";

  position: absolute;
  top: 0;

  width: 100%;
  height: 100%;

  background-image:
    url("/static/img/home_clouds_layer.png");

  background-repeat: repeat-x;

  background-size:
    680px auto;

  background-position:
    center top;

  animation:
    cloudsRoll 80s linear infinite;

  will-change: transform;
}

.clouds-layer::before {
  left: 0;
}

.clouds-layer::after {
  left: -100%;
}

@keyframes cloudsRoll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(100%);
  }
}

.home-page {
  position: relative;
  z-index: 2;

  width: 100%;
  min-height: 100vh;
  padding: 40px 22px 80px;
}

.mobile-home-hero {
  --hero-progress: 0;

  width: 100%;
  max-width: 920px;
  min-height: calc(100vh + 520px);
  margin: 0 auto;
}

.hero-top-block {
  position: sticky;
  top: 0;
  min-height: 100vh;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  z-index: 4;

  transform:
    translateY(calc(var(--hero-progress) * -300px));
}

.animated-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 26px;
}

.home-logo {
  width: min(88vw, 520px);
  display: block;
  transform-origin: center;

  transform:
    scale(calc(1 - (var(--hero-progress) * 0.62)));

  animation: logoIntro 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes logoIntro {
  0% {
    opacity: 0;
    transform: scale(1.45);
  }

  100% {
    opacity: 1;
  }
}

.hero-realtime-text {
  margin: 0;

  text-align: center;

  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 900;

  letter-spacing: -0.04em;

  color: var(--color-text-soft);

  opacity:
    calc(1 - (var(--hero-progress) * 1.8));

  transform:
    translateY(calc(var(--hero-progress) * -42px));
}

.mobile-home-layout {
  width: 100%;
  max-width: 760px;

  margin: -12vh auto 0;

  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;

  position: relative;
  z-index: 5;
}

.middle-cards-row {
  width: 100%;

  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 72px;
}

.ecosystem-card {
  position: relative;

  width: 100%;
  min-height: 176px;

  padding: 26px;

  border-radius: 34px;

  background: rgba(255, 255, 255, 0.9);

  border: 1px solid rgba(255, 255, 255, 0.48);

  backdrop-filter: blur(10px);

  box-shadow: 0 20px 46px rgba(32, 18, 8, 0.075);

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  text-align: center;

  opacity: 0;

  transform:
    translateY(28px)
    scale(0.96);

  transition:
    opacity 420ms ease,
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 180ms ease;
}

.mobile-home-hero.show-card-1 .ecosystem-card-main,
.mobile-home-hero.show-card-2 .middle-cards-row .ecosystem-card:nth-child(1),
.mobile-home-hero.show-card-3 .middle-cards-row .ecosystem-card:nth-child(2),
.mobile-home-hero.show-card-4 .ecosystem-card-bottom {
  opacity: 1;

  transform:
    translateY(0)
    scale(1);
}

.ecosystem-card:hover {
  transform: translateY(-4px) scale(1);
  box-shadow: 0 26px 64px rgba(32, 18, 8, 0.12);
}

.ecosystem-card-main,
.ecosystem-card-bottom {
  width: min(100%, 300px);
  min-height: 186px;
  margin: 0 auto;
}

.ecosystem-icon {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 18px;
}

.ecosystem-card h2 {
  margin: 0;
  font-size: 1.38rem;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--color-text);
}

.ecosystem-card p {
  margin-top: 12px;
  max-width: 220px;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--color-text-soft);
}

.content-section {
  width: 100%;
  max-width: 1100px;

  margin: 90px auto 0;

  padding: 42px 28px;

  border-radius: 42px;

  background: rgba(255, 255, 255, 0.72);

  backdrop-filter: blur(10px);

  box-shadow: 0 18px 50px rgba(32, 18, 8, 0.08);
}

.section-label {
  display: inline-flex;
  margin-bottom: 16px;

  font-size: 0.82rem;
  font-weight: 900;

  letter-spacing: 0.14em;
  text-transform: uppercase;

  color: var(--color-primary);
}

.content-section h2 {
  margin: 0;

  font-size: clamp(2rem, 5vw, 3.5rem);

  line-height: 1.05;
  letter-spacing: -0.05em;

  color: var(--color-text);
}

.content-section p {
  max-width: 720px;
  margin-top: 20px;

  font-size: 1.05rem;
  line-height: 1.7;

  color: var(--color-text-soft);
}

.workflow-grid {
  margin-top: 36px;

  display: grid;
  gap: 18px;
}

.workflow-card {
  padding: 26px;

  border-radius: 26px;

  background: white;

  box-shadow: 0 14px 40px rgba(32, 18, 8, 0.06);

  display: flex;
  align-items: center;
  gap: 14px;

  font-weight: 700;
}

.workflow-card strong {
  width: 34px;
  height: 34px;

  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--color-primary);
  color: white;
}

.features-grid {
  margin-top: 36px;

  display: grid;
  gap: 18px;

  grid-template-columns: repeat(2, 1fr);
}

.feature-card {
  padding: 24px;

  border-radius: 24px;

  background: white;

  box-shadow: 0 14px 40px rgba(32, 18, 8, 0.06);

  font-weight: 700;
  text-align: center;
}

.final-section {
  text-align: center;
}

.primary-button {
  min-height: 54px;

  padding: 0 26px;
  margin-top: 34px;

  border-radius: 999px;

  background: var(--color-primary);
  color: white;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-weight: 800;
  text-decoration: none;

  box-shadow: 0 14px 34px rgba(239, 108, 0, 0.24);

  transition: transform 180ms ease;
}

.primary-button:hover {
  transform: translateY(-3px);
}

@media (max-width: 430px) {

  body {
    overflow-x: hidden;
  }

  .clouds-layer {
    height: 68vh;
    width: 100%;
    left: 0;
  }
  
  .clouds-layer::before,
  .clouds-layer::after {
    background-image:
      url("/static/img/home_clouds_layer.png");
  
    background-repeat: repeat-x;
  
    background-size: 600px auto;
  
    background-position:
      center 52px;
  
    background-origin: border-box;
    background-clip: border-box;
  
    animation:
      cloudsRoll 80s linear infinite;
  
    will-change: transform;
  }

  .home-page {
    padding: 42px 18px 80px;
    overflow-x: hidden;
  }

  .mobile-home-hero {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  
    min-height: calc(100vh + 120px);
  }

  .hero-top-block {
    transform:
      translateY(calc(-70px + (var(--hero-progress) * -170px)));
  }

  .animated-logo-wrap {
    width: 100%;
    overflow: visible;
  }

  .home-logo {
    width: min(74vw, 300px);
    max-width: 100%;
  
    object-fit: contain;
  
    transform:
      scale(calc(1 - (var(--hero-progress) * 0.42)));
  
    animation: none;
  }

  .hero-realtime-text {
    font-size: 1.1rem;
  }

  .mobile-home-layout {
    max-width: 100%;
    margin-top: -40vh;
  }

  .middle-cards-row {
    gap: 18px;
  }

  .ecosystem-card {
    padding: 22px 18px;
    border-radius: 30px;
  }

  .ecosystem-card-main,
  .ecosystem-card-bottom {
    width: min(100%, 292px);
  }

  .ecosystem-card h2 {
    font-size: 1.28rem;
  }

  .ecosystem-card p {
    font-size: 0.82rem;
    line-height: 1.34;
  }
}

@media (min-width: 768px) {
  .workflow-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-top-block,
  .home-logo,
  .hero-realtime-text,
  .ecosystem-card {
    transition: none;
    animation: none;
    transform: none;
  }

  .ecosystem-card {
    opacity: 1;
  }
}

@media (max-width: 430px) {
  @keyframes logoIntro {
    0% {
      opacity: 0;
      transform: scale(1.08);
    }

    100% {
      opacity: 1;
    }
  }
}