/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: #080a12;
  color: #ffffff;
  user-select: none;
  -webkit-user-select: none;
}

/* Page Index Specific: Lock scrolling only on home screen index */
body.page-index {
  height: 100vh;
  overflow: hidden;
}

body.page-index .app-container {
  height: 100vh;
  overflow: hidden;
}

/* Main Container with Background */
.app-container {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-image: url('Resources/sfondo-sito.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Hero Stage Section */
.hero-stage {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1200px;
  padding: 2rem;
  transition: transform 0.6s ease, filter 0.6s ease, opacity 0.6s ease;
}

.hero-stage.blurred {
  transform: scale(0.96);
  filter: blur(8px);
  opacity: 0.6;
}

/* Dynamic Title above cards (Figma Specs) */
.deck-title-wrapper {
  text-align: center;
  margin-bottom: 2.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.deck-title {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: clamp(2.6rem, 5.2vw, 4.5rem);
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1.1;
  background: linear-gradient(180deg, #FFAE34 0%, #FF5F00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 12px rgba(255, 95, 0, 0.4));
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.deck-subtitle {
  font-size: clamp(0.85rem, 1.5vw, 1.05rem);
  font-style: italic;
  color: rgba(220, 225, 240, 0.65);
  margin-top: 6px;
  letter-spacing: 0.8px;
  transition: opacity 0.25s ease;
}

.deck-title.switching,
.deck-subtitle.switching {
  opacity: 0;
  transform: translateY(-8px);
}

/* Swappable 3D Card Deck */
.cards-deck {
  position: relative;
  width: clamp(250px, 28vw, 360px);
  height: clamp(340px, 38vw, 500px);
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1400px;
}

/* Each Deck Card Container */
.deck-card {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  cursor: pointer;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1),
              filter 0.5s ease,
              opacity 0.45s ease;
  will-change: transform, filter, opacity;
}

/* 3D Flipper Inside Card */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.2, 0.8, 0.2, 1.1);
}

.deck-card.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* Card Back (Default visible side: retro.png) */
.card-back {
  transform: rotateY(0deg);
}

/* Card Front (Revealed on flip / launch) */
.card-front {
  transform: rotateY(180deg);
}

.card-front img {
  border-radius: 18px;
  filter: drop-shadow(0 20px 45px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 25px rgba(255, 120, 0, 0.3));
}

/* DIRECT CARD FORM FRONT FACE (Embedded in Let's Connect Card) */
.card-form-face {
  background: linear-gradient(150deg, rgba(22, 28, 50, 0.98) 0%, rgba(10, 12, 26, 0.99) 100%);
  border: 2px solid rgba(255, 140, 0, 0.65);
  border-radius: 20px;
  padding: 1.2rem 1.4rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 35px rgba(255, 120, 0, 0.3);
  overflow: hidden;
  user-select: auto;
  -webkit-user-select: auto;
}

.card-form-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Flip Back Arrow inside Form Card */
.card-unflip-btn {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.card-unflip-btn:hover {
  background: rgba(255, 140, 0, 0.3);
  border-color: rgba(255, 160, 40, 0.7);
  transform: scale(1.08);
}

.card-form-header {
  text-align: center;
  margin-top: 0.2rem;
  margin-bottom: 0.6rem;
}

.card-form-title {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #FFAE34 0%, #FF5F00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 6px rgba(255, 95, 0, 0.35));
}

.card-form-subtitle {
  font-size: 0.75rem;
  color: rgba(220, 225, 240, 0.7);
  margin-top: 2px;
}

.card-connect-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  justify-content: center;
}

.card-form-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.card-form-group label {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.card-form-group input,
.card-form-group textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.82rem;
  color: #ffffff;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.card-form-group input::placeholder,
.card-form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.card-form-group input:focus,
.card-form-group textarea:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 140, 0, 0.85);
  box-shadow: 0 0 12px rgba(255, 140, 0, 0.3);
}

.card-form-group textarea {
  resize: none;
}

.card-submit-btn {
  margin-top: 0.3rem;
  width: 100%;
  height: 42px;
  border-radius: 9999px;
  border: none;
  background: linear-gradient(135deg, #FF9A00 0%, #FF4500 100%);
  color: #ffffff;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 80, 0, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

.card-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(255, 80, 0, 0.65);
  filter: brightness(1.1);
}

/* Success State Inside Card */
.card-success-message {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 0.5rem;
  gap: 0.8rem;
  flex: 1;
}

.card-success-message.active {
  display: flex;
}

.card-success-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF9A00 0%, #FF4500 100%);
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(255, 120, 0, 0.6);
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-success-message h4 {
  font-size: 1.3rem;
  font-weight: 800;
  font-style: italic;
  color: #ffffff;
}

.card-success-message p {
  color: rgba(230, 235, 245, 0.8);
  font-size: 0.82rem;
}

/* Deck Position States */
.deck-card.pos-center {
  transform: translate3d(0, 0, 50px) rotate(-1.5deg) scale(1);
  z-index: 10;
  filter: drop-shadow(0 20px 45px rgba(0, 0, 0, 0.85));
}

.deck-card.pos-center:hover {
  transform: translate3d(0, -8px, 70px) rotate(0deg) scale(1.02);
  filter: drop-shadow(0 25px 55px rgba(0, 0, 0, 0.9));
}

.deck-card.pos-right {
  transform: translate3d(42px, 12px, -30px) rotate(8deg) scale(0.96);
  z-index: 5;
  filter: drop-shadow(8px 12px 25px rgba(0, 0, 0, 0.75)) brightness(0.92);
}

.deck-card.pos-right:hover {
  transform: translate3d(58px, 8px, -10px) rotate(11deg) scale(0.98);
  filter: drop-shadow(12px 16px 30px rgba(0, 0, 0, 0.8)) brightness(1);
}

.deck-card.pos-left {
  transform: translate3d(-45px, 16px, -60px) rotate(-10deg) scale(0.92);
  z-index: 2;
  filter: drop-shadow(-8px 12px 25px rgba(0, 0, 0, 0.75)) brightness(0.88);
}

.deck-card.pos-left:hover {
  transform: translate3d(-62px, 12px, -40px) rotate(-13deg) scale(0.94);
  filter: drop-shadow(-12px 16px 30px rgba(0, 0, 0, 0.8)) brightness(0.96);
}

/* Linear Clean Card Launching Animation into New Page */
.deck-card.card-launching {
  z-index: 100 !important;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
  transform: translate3d(0, -35px, 180px) scale(1.12) !important;
}

.cards-deck.animating-exit .deck-card:not(.card-launching) {
  opacity: 0;
  transform: translate3d(0, 40px, -100px) scale(0.85);
  transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Smooth Linear Page Transition Overlay */
.page-transition-overlay {
  position: fixed;
  inset: 0;
  background: #080a12;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.5s ease;
}

.page-transition-overlay.active {
  opacity: 1;
}

/* Deck Controls: Arrows & Dots */
.deck-controls {
  margin-top: 2.2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.swap-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
}

.swap-arrow:hover {
  background: rgba(255, 140, 0, 0.3);
  border-color: rgba(255, 160, 40, 0.6);
  transform: scale(1.08);
}

.deck-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: all 0.3s ease;
}

.dot.active {
  width: 24px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #FFAE34, #FF5F00);
  box-shadow: 0 0 10px rgba(255, 120, 0, 0.6);
}

/* Responsive */
@media (max-width: 600px) {
  .deck-title {
    font-size: 2.2rem;
  }
  .cards-deck {
    width: 260px;
    height: 380px;
  }
  .card-form-face {
    padding: 1rem;
  }
  .card-form-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.2rem;
  }
}


/* TEAM card in the deck: logo on dark card with orange frame */
.card-logo-face {
  background: linear-gradient(150deg, rgba(22, 28, 50, 0.98) 0%, rgba(10, 12, 26, 0.99) 100%);
  border: 2px solid rgba(255, 140, 0, 0.65);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 35px rgba(255, 120, 0, 0.3);
  padding: 1.4rem;
}

.card-front.card-logo-face img {
  border-radius: 0;
  filter: none;
}
